-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
@@ -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() { |
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.
why is this change fine?
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.
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.
* We can always try to remove without checking first * Remove redundant condition * Simplify log message * Revert simplification * Remove intermediate write guard
* We can always try to remove without checking first * Remove redundant condition * Simplify log message * Revert simplification * Remove intermediate write guard
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:
dev
branch. Did you create your branch fromdev
?New Feature Submissions:
cargo +nightly fmt --all
command prior to submission?cargo clippy --all --all-features
command?