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

Only track pending client resets done by the same core version #7944

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

tgoyne
Copy link
Member

@tgoyne tgoyne commented Aug 1, 2024

If the previous attempt at performing a client reset was done with a different core version than the current one, then attempting the client reset again is not yet a cycle as something significant has changed between the two attempts. This means that we don't actually need the ability to read old client reset tracker schemas; if the schema isn't an exact match we can just discard the existing data.

Running with the idea that retrying the client reset if the core version has changed is not only acceptable but desirable, I also made it store the exact core version which wrote the tracker entry and discard it if the version has changed even if the schema hasn't.

Since I was touching the schema for this anyway, I removed the unused primary key and made the error fields required - we never actually used a null error, and the code reading the tracker entry crashed if it encountered one (obj.get<int64_t>() requires that you check for null first, which the code didn't do).

@tgoyne tgoyne added the no-jira-ticket Skip checking the PR title for Jira reference label Aug 1, 2024
@tgoyne tgoyne self-assigned this Aug 1, 2024
@cla-bot cla-bot bot added the cla: yes label Aug 1, 2024
If the previous attempt at performing a client reset was done with a different
core version then we should retry the client reset as the new version may have
fixed a bug that made the previous attempt fail (or may be a downgrade to a
version before when the bug was introduced). This also simplifies the tracking
as it means that we don't need to be able to read trackers created by different
versions.

This also means that we can freely change the schema of the table, which this
takes advantage of to drop the unused primary key and make the error required,
as we never actually stored null and the code reading it would have crashed if
it encountered a null error.
@tgoyne tgoyne force-pushed the tg/client-reset-core-version branch from 5a1a7b6 to 1815605 Compare August 2, 2024 17:32
@tgoyne tgoyne marked this pull request as ready for review August 2, 2024 18:37
@tgoyne tgoyne requested review from ironage and michael-wb August 2, 2024 18:37
Copy link

Pull Request Test Coverage Report for Build thomas.goyne_478

Details

  • 138 of 153 (90.2%) changed or added relevant lines in 10 files are covered.
  • 85 unchanged lines in 16 files lost coverage.
  • Overall coverage decreased (-0.01%) to 91.089%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/realm/sync/noinst/sync_metadata_schema.cpp 17 32 53.13%
Files with Coverage Reduction New Missed Lines %
src/realm/mixed.cpp 1 86.46%
test/fuzz_tester.hpp 1 57.73%
test/test_dictionary.cpp 1 99.83%
src/realm/object-store/shared_realm.cpp 2 91.89%
src/realm/query_expression.cpp 2 86.62%
src/realm/sync/network/network.cpp 3 87.95%
src/realm/sync/noinst/protocol_codec.hpp 3 74.0%
src/realm/sync/noinst/sync_metadata_schema.cpp 3 76.5%
src/realm/table.cpp 3 90.59%
src/realm/unicode.cpp 3 83.83%
Totals Coverage Status
Change from base Build 2537: -0.01%
Covered Lines: 216717
Relevant Lines: 237917

💛 - 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.

Good idea! LGTM. 👍

Copy link
Contributor

@michael-wb michael-wb left a comment

Choose a reason for hiding this comment

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

LGTM - I like this better than my original approach of trying to convert the record over - and it make sense to try to restart the client reset again after an upgrade.

@tgoyne tgoyne merged commit bf62783 into master Aug 5, 2024
47 checks passed
@tgoyne tgoyne deleted the tg/client-reset-core-version branch August 5, 2024 16:04
@github-actions github-actions bot mentioned this pull request Aug 9, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes no-jira-ticket Skip checking the PR title for Jira reference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants