Closed ph33rtehgd closed 8 months ago
I've narrowed down the issue to the AnchorDataListHolder class. The calls on lines 41 and 42 to the following:
var key = serializationService.ToObject(keyData); var value = serializationService.ToObject(valueData);
don't first ensure that the schemas have been fetched. If I modify the order in which the paging predicate and results are processed in the GetEntriesAsync method in HMap.Getting.cs and make sure that the AddAsync method on the ReadOnlyLazyDictionary (which internally calls EnsureCanDeserialize first) is called before the pagingPredicate.UpdateAnchors is called this issue seems to be avoided. Example below:
I presume this change (or something similar) would have to be made in the various places where a paging predicate is involved.
Investigating...
Have submitted a PR. It's not enough to swap the order of things... we need to ensure that anchors, as well as values, can be properly deserialized.
I'm back with another observation on compact serialization. The issue I'm seeing is very similar to this issue (https://github.com/hazelcast/hazelcast-csharp-client/issues/772). I know that a fix was implemented at the time this issue was closed, however I'm observing a similar problem. I haven't had time to dive into the Hazelcast C# client code this time to identify exactly where the issue is, however I can provide the steps I used to replicate the issue as well as what I've done as a workaround.
If I attempt to connect to a running Hazelcast instance that already has data loaded into a map and run a getEntriesAsync(predicate) or getValuesAsync(predicate) method call where the predicate uses a Paging Predicate (Predicates.Page) as its outer predicate I get an UnknownSchemaException. If I make these same method calls without a predicate (no parameter to the methods) or a SQL predicate that isn't wrapped in a paging predicate the data is retrieved with no issues.
As a workaround (aside from not using the paging predicate), I can call a getKeysAsync(), take one key from the returned list, call getAsync() with that key, and I can then call the getEntriesAsync/getValuesAsync with predicates with no issues.
What I suspect is that when making the method calls containing paging predicates there is some issue with requesting the schema from the Hazelcast cluster at the time the data is being deserialized. The calls which use no predicates, no paging predicate or use a single key seem to be fetching the schema properly first before deserializing and thus by calling these methods first it primes the schema on the C# client, allowing future calls using paging predicates to function as expected.