[go: up one dir, main page]

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

Tiny refactoring during data race investigation #5299

Merged
merged 5 commits into from
Oct 30, 2024

Conversation

timvisee
Copy link
Member

Tiny improvements I made on top of #5298.

To prevent cluttering the main PR - making the problem harder to understand - I moved them to a separate PR.

These changes are not significant and don't include any logic changes.

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --all --all-features command?

@timvisee timvisee marked this pull request as ready for review October 23, 2024 14:21
@@ -305,7 +305,7 @@ impl ShardOperation for ForwardProxyShard {
let tick = result.clock_tag.map(|tag| tag.clock_tick);
let remote_tick = remote_result.clock_tag.map(|tag| tag.clock_tick);

if remote_tick > tick || tick.is_none() {
Copy link
Member

Choose a reason for hiding this comment

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

why is this change fine?

Copy link
Member Author
@timvisee timvisee Oct 24, 2024

Choose a reason for hiding this comment

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

The simplified condition behaves slightly different on inputs:

remote_tick tick Before After
None None true false
Some None true true
None Some false false
Some(1) Some(2) false false
Some(2) Some(1) true true
Some(1) Some(1) false false

There's one discrepancy as you can see. However, in that case the clock tag itself will be exactly the same, and so the end result is exactly the same.

Even though it's fine, I'll revert my change because the previous version may be a bit easier to understand.

@timvisee timvisee merged commit 16fbe53 into dev Oct 30, 2024
17 checks passed
@timvisee timvisee deleted the fix-recovery-state-data-race-improvements branch October 30, 2024 16:51
n0x29a pushed a commit that referenced this pull request Nov 4, 2024
* We can always try to remove without checking first

* Remove redundant condition

* Simplify log message

* Revert simplification

* Remove intermediate write guard
timvisee added a commit that referenced this pull request Nov 8, 2024
* We can always try to remove without checking first

* Remove redundant condition

* Simplify log message

* Revert simplification

* Remove intermediate write guard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants