-
Notifications
You must be signed in to change notification settings - Fork 173
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
RCORE-2030 Add full support for automatic client reset for collections in mixed #7683
RCORE-2030 Add full support for automatic client reset for collections in mixed #7683
Conversation
Pull Request Test Coverage Report for Build daniel.tabacaru_829Details
💛 - Coveralls |
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.
Still reviewing, but here's my first couple of minor comments
auto size_src = n_src_list->size(); | ||
auto size_dst = n_dst_list->size(); | ||
if (size_src != size_dst) | ||
REALM_ASSERT(src_dictionary.contains(key) && dst_dictionary.contains(key)); |
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 we just return false
here instead of an assert?
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.
it's sort of a problem if the key (and the indexes in check_matching_list) is not in the dictionary. the caller ensures that (haven't really changed that). I added these to mostly catch unexpected behavior during development (i could turn it into debug asserts if it makes more sense).
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.
Agreed.
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.
Still reviewing, but here's my first couple of minor comments
@@ -626,52 +626,68 @@ void RecoverLocalChangesetsHandler::copy_lists_with_unrecoverable_changes() | |||
bool RecoverLocalChangesetsHandler::resolve_path(ListPath& path, Obj remote_obj, Obj local_obj, |
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.
This method is one of the trickier changes in this PR, could you take a look at the coverage report and try to test some more of the uncovered corner cases?
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.
agreed.
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.
A couple of minor suggestions but otherwise LGTM!
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.
Looking good so far.
auto size_src = n_src_list->size(); | ||
auto size_dst = n_dst_list->size(); | ||
if (size_src != size_dst) | ||
REALM_ASSERT(src_dictionary.contains(key) && dst_dictionary.contains(key)); |
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.
Agreed.
@@ -989,14 +1021,55 @@ void RecoverLocalChangesetsHandler::operator()(const Instruction::Clear& instr) | |||
ClearResolver(RecoverLocalChangesetsHandler* applier, Instruction::Clear& instr) | |||
: RecoveryResolver(applier, instr, "Clear") | |||
{ | |||
switch (instr.collection_type) { | |||
case Instruction::CollectionType::Single: | |||
break; |
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.
I think this is actually REALM_UNREACHABLE ?
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.
we could be recovering instructions from a client that did not generate the collection type, so we play safe (same in the InstructionApplier)
@@ -626,52 +626,68 @@ void RecoverLocalChangesetsHandler::copy_lists_with_unrecoverable_changes() | |||
bool RecoverLocalChangesetsHandler::resolve_path(ListPath& path, Obj remote_obj, Obj local_obj, |
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.
agreed.
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-a lot of updates to support collections in mixed and it's good to see plenty of test coverage to help ensure it's working as expected.
What, How & Why?
The recovery of local instructions operating on nested collections follows closely the recovery of operations on embedded objects (you can think of a nested dictionary or list as an embedded object).
Notably:
Additionally, I fixed a crash when recovering AddInteger instructions on a non-integer value (changed remotely).
Fixes #7490.
☑️ ToDos
[ ] C-API, if public C++ API changed[ ]bindgen/spec.yml
, if public C++ API changed