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

RCORE-2203 Merge Role Changes feature branch into Core master #7897

Merged
merged 24 commits into from
Jul 19, 2024

Conversation

michael-wb
Copy link
Contributor

What, How & Why?

Merging the "Handle Role Changes without Client Reset" feature to Core Master from the feature branch.

Fixes #7896

☑️ ToDos

  • 📝 Changelog update
  • 🚦 Tests (or not relevant)
  • [ ] C-API, if public C++ API changed
  • [ ] bindgen/spec.yml, if public C++ API changed

Michael Wilkerson-Barker added 23 commits June 11, 2024 13:13
…7440)

* First round of changes for server-initiated bootstraps

* Added test for role change bootstraps

* Updated test for handle role bootstraps

* Updated baas/baasaas to use branch with fixes

* Updated test to verify bootstrap actually occurred

* Fixed tsan warning

* Updates from review; added comments to clarify bootstrap detection logic

* Reworked test to fix msvc failure

* Reverted baas branch to master and protocol version to 12

* Added comments to changes needed when merging to master; update baas version to not use master

* Pulled over changes from other branch and tweaking download params

* Refactored tests to validate different bootstrap types

* Address test failures

* Updated tests to get passing using the server params

* Updated to support new batch_state protocol changes; updated tests

* Updated role change tests and merged test from separate PR

* Fixed issue with flx query verion 0 not being treated as a bootstrap

* Cleaned up the tests a bit and reworked query version 0 handling

* Updates from review; updated batch_state for schema bootstraps

* Removed extra mutex in favor of state machine's mutex

* Increased timeout when waiting for app initial sync to complete

* Updated role change test to use test commands

* Update resume and ident message handling

* Updated future waits for the pause/resume test command

* Added session connected event for when session multiplexing is disabled

* Updates from review; updated baas commit to include timing fix

* Added wait_until() to state machine to wait for callback; updated role change test
* Moved role change tests to separate test file

* Fixed building of new flx_role_change.cpp file

* Added local changes w/role bootstrap test - fixed exception in subscription store during server initiated boostrap

* Updated local change test to include valid offline writes during role change

* Added role change test during initial schema bootstrap

* Wrapped up role change during bootstrap tests

* Removed debug statments to fix thread sanitizer

* Updated sub state comments and reverted a minor change

* Refactored role change tests and broke out into 2 separate test cases

* Moved harness from a global to a static var in each test case

* Reverted resetting the bootstrapping subscription state back to Pending

* Updated baas to use protocol v14 and removed the feature flag for role change bootstraps

* Removed left over code in  statement...

* Updated baasaas version to be a cached version

* Updated baasaas githash and reordered role change during bootstrap to check for role change bootstrap as first validation step

* Minor updates to reuse the verify_records() fcn

* RCORE-2174 Bootstrap store is not being reset if initial subscription bootstrap is interrupted by role change (#7831)

* Updated pending bootstrap store to be processed (applied or cleared) when the session or connection is restarted without restarting the Sync Session
…#7840)

* re-applied changes after base branch was merged to feature branch

* Updates to address test failures

* Disable role change check during fresh realm download

* Updated comments for clarity

* Update from review

* Update from review

* Updates from review; added a bunch of comments to test

* Updates to role change tests per review comments

* removed ostream support for SyncClientHookEvent
@michael-wb michael-wb self-assigned this Jul 18, 2024
@cla-bot cla-bot bot added the cla: yes label Jul 18, 2024
Copy link

coveralls-official bot commented Jul 18, 2024

Pull Request Test Coverage Report for Build michael.wilkersonbarker_1285

Details

  • 920 of 998 (92.18%) changed or added relevant lines in 12 files are covered.
  • 40 unchanged lines in 14 files lost coverage.
  • Overall coverage increased (+0.04%) to 91.006%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/realm/sync/protocol.hpp 11 12 91.67%
src/realm/sync/noinst/protocol_codec.hpp 5 8 62.5%
src/realm/sync/noinst/client_impl_base.cpp 19 23 82.61%
src/realm/sync/client.cpp 14 26 53.85%
test/object-store/util/sync/baas_admin_api.cpp 45 68 66.18%
test/object-store/sync/flx_role_change.cpp 795 830 95.78%
Files with Coverage Reduction New Missed Lines %
src/realm/array_mixed.cpp 1 94.02%
src/realm/array_string.cpp 1 88.03%
src/realm/dictionary.cpp 1 85.16%
src/realm/mixed.cpp 1 86.61%
src/realm/object-store/sync/sync_session.cpp 1 92.01%
test/fuzz_tester.hpp 1 57.73%
src/realm/object-store/shared_realm.cpp 2 91.89%
src/realm/query_expression.cpp 2 86.62%
src/realm/sync/noinst/server/server.cpp 2 73.93%
src/realm/collection_parent.cpp 3 93.08%
Totals Coverage Status
Change from base Build 2497: 0.04%
Covered Lines: 216341
Relevant Lines: 237721

💛 - Coveralls

Copy link
Contributor

@ironage ironage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am assuming that the composite PR reviews have already done their due diligence. But LGTM overall. Nice work with the detailed tests. 👍

@@ -1233,6 +1200,10 @@ void SessionWrapper::on_flx_sync_progress(int64_t new_version, DownloadBatchStat
if (!has_flx_subscription_store()) {
return;
}
// Is this a server-initiated bootstrap? Skip notifying the subscription store
if (new_version == m_flx_active_version) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also checked again in the DownloadBatchState::LastInBatch case, so one of these is redundant.

It appears that if the server sends us a bootstrap for a version other than what we think the active query version is we'll hit an assertion failure rather than reporting a protocol invariant failure.

@@ -123,6 +123,7 @@ enum class ClientResyncMode : unsigned char {
RecoverOrDiscard,
};

// Also update sync_test_utils.hpp when adding new values
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth doing something similar to what instructions.hpp does with REALM_FOR_EACH_INSTRUCTION_TYPE to avoid having to update multiple places?

@michael-wb michael-wb requested a review from tgoyne July 18, 2024 21:19
@@ -5,3 +5,4 @@ ZLIB_VERSION: 1.2.13
# https://github.com/10gen/baas/commits
# 2f308db is 2024 July 10
BAAS_VERSION: 2f308db6f65333728a101d1fecbb792f9659a5ce
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the server using v14 already? and more specifically, do we need to bump this version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the server has already been released - this is the same version that we are using on master (updated last week) which includes these changes.

@michael-wb michael-wb merged commit 45f1e85 into master Jul 19, 2024
41 checks passed
@michael-wb michael-wb deleted the feature/role-change branch July 19, 2024 00:39
@kiburtse kiburtse mentioned this pull request Jul 19, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Merge Role Changes feature branch into Core master
4 participants