Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compact Serialization: UnknownSchemaException when using Paging Predicates on getEntriesAsync, etc. #868

Closed
ph33rtehgd opened this issue Jan 5, 2024 · 3 comments · Fixed by #876
Assignees
Labels
Priority: High High Priority. Source: Community Originated from the Community. State: Review Please review this PR!

Comments

@ph33rtehgd
Copy link

ph33rtehgd commented Jan 5, 2024

I'm back with another observation on compact serialization. The issue I'm seeing is very similar to this issue (#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.

@ph33rtehgd
Copy link
Author

ph33rtehgd commented Jan 5, 2024

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:

image

I presume this change (or something similar) would have to be made in the various places where a paging predicate is involved.

@zpqrtbnk zpqrtbnk self-assigned this Jan 26, 2024
@zpqrtbnk zpqrtbnk added Priority: High High Priority. Source: Community Originated from the Community. State: Active Issue is Active (working on it) labels Jan 26, 2024
@zpqrtbnk
Copy link
Contributor

Investigating...

@zpqrtbnk zpqrtbnk mentioned this issue Feb 2, 2024
@zpqrtbnk zpqrtbnk linked a pull request Feb 2, 2024 that will close this issue
@zpqrtbnk zpqrtbnk added State: Review Please review this PR! and removed State: Active Issue is Active (working on it) labels Feb 2, 2024
@zpqrtbnk
Copy link
Contributor

zpqrtbnk commented Feb 2, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: High High Priority. Source: Community Originated from the Community. State: Review Please review this PR!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants