-
Notifications
You must be signed in to change notification settings - Fork 167
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
Distinguish between an empty and a null (not existing) reciprocal changeset #6367
Distinguish between an empty and a null (not existing) reciprocal changeset #6367
Conversation
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 - I'm surprised this hasn't manifested in other ways than just the list out of order, although that might be the easiest one to detect.
test/test_sync.cpp
Outdated
if (is_compressed) { | ||
size_t total_size; | ||
auto decompressed = util::compression::decompress_nonportable_input_stream(in, total_size); | ||
REALM_ASSERT(decompressed); |
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.
Update this to CHECK()
or REQUIRE()
so it integrates better into the test.
This is an excellent find, my only question is whether we're fixing this at the right place. Is it ever valid to call
Also, do we want to include the reproduction from the original issue here that actually instantiates some arrays and does moves on them as a slightly higher level integration test? |
It looks like this bug was introduced in ae2e6d3. I removed the check which ensured that empty data was stored as empty instead of null because the compressed data would always have a header, and then changed it so that zero byte input compressed to zero byte output and made the check necessary again. add_sync_history_entry() may also need the check restored. |
Thanks a lot for the insight. I restored the checks as they were before |
I wanted to add that specific test but I need control on the changesets' timestamp to hit the critical code path which is not straightforward. |
CHANGELOG.md
Outdated
@@ -6,7 +6,7 @@ | |||
|
|||
### Fixed | |||
* <How do the end-user experience this issue? what was the impact?> ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?) | |||
* None. | |||
* Fixed a case of history diverging when empty reciprocal changesets are part of the merging window in OT ([#6191](https://github.com/realm/realm-core/issues/6191), since v11.13.0) |
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.
Can you add something here like - this may have resulted in arrays being in different orders on different devices - so that users reading this will know what symptom to look for?
What, How & Why?
Once a reciprocal changeset has all its instructions discarded during OT, it is stored as a null changeset in the realm. This makes it hard to differentiate it from a non-existing reciprocal changeset and was causing histories to diverge among clients. A fix was put in place so that an empty reciprocal changeset is indeed saved as an empty changeset in the realm.
Fixes #6191.
☑️ ToDos
C-API, if public C++ API changed.