-
Notifications
You must be signed in to change notification settings - Fork 73
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
Eagerly deserialize responses consisting of list of data [API-1964] #618
Conversation
We were performing lazy deserialization on APIs that return a list of data, such as map#values(). This was not going to work with Compact, as after returning the list to the user, there might be Compact serialized data on the list which we don't have the schema on the client yet. If it was a normal response, the client would have fetched the schema, but it is not possible with these lazy APIs. We perform the deserialization while getting the list items and this is a sync API. We can't perform a blocking call there, because there is a chance that this will be executed in the reactor thread, which would result in a deadlock. So, the only possible way of making these APIs work with Compact is to convert them to eager deserialization. This PR removes lazy deserialization in everything apart from SQL, which will be handled in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a minor idea...
hazelcast/util.py
Outdated
@@ -175,6 +135,21 @@ def get_portable_version(portable, default_version): | |||
return version | |||
|
|||
|
|||
def deserialize_list_in_place(data_list, to_object_fn): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be type annotation for the new functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense, I wish we fully type hint the code base so that we can add checks for such things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov Report
@@ Coverage Diff @@
## master #618 +/- ##
=======================================
Coverage 96.48% 96.49%
=======================================
Files 357 357
Lines 20519 20554 +35
=======================================
+ Hits 19798 19833 +35
Misses 721 721
... and 5 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
We were performing lazy deserialization on APIs that return a list of data, such as map#values(). This was not going to work with Compact, as after returning the list to the user, there might be Compact serialized data on the list which we don't have the schema on the client yet. If it was a normal response, the client would have fetched the schema, but it is not possible with these lazy APIs. We perform the deserialization while getting the list items and this is a sync API. We can't perform a blocking call there, because there is a chance that this will be executed in the reactor thread, which would result in a deadlock.
So, the only possible way of making these APIs work with Compact is to convert them to eager deserialization.
This PR removes lazy deserialization in everything apart from SQL, which will be handled in another PR.