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

Check for LEADING *after* waiting to be LEADING or FOLLOWING #1873

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

tylerkaraszewski
Copy link
Contributor

Details

This fixes a bug noticed when investigating a fork.

If we attempt to start a command, but are not LEADING or FOLLOWING (see lines 783-796, the collapsed section between the changes) we wait until we are before doing anything.

However, we've performed the canWriteParallel before we wait for this state change, so we could have been SEARCHING before the wait, and LEADING after. This will cause canWriteParallel to be false when it should not be. This leads to commands running in the sync thread that do not need to.

This change moves the check for LEADING to after the state of the server has stabilized.

I don't believe this actually affects the fork that occurred, but it is a detriment to performance.

Fixed Issues

Fixes https://github.com/Expensify/Expensify/issues/384477

Tests


Internal Testing Reminder: when changing bedrock, please compile auth against your new changes

@tylerkaraszewski tylerkaraszewski requested review from cead22, flodnv and a team September 18, 2024 17:52
@tylerkaraszewski tylerkaraszewski self-assigned this Sep 18, 2024
@melvin-bot melvin-bot bot requested review from dangrous and removed request for a team September 18, 2024 17:52
Copy link

@dangrous dangrous left a comment

Choose a reason for hiding this comment

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

This makes enough sense to me based on the description provided, but I definitely defer to those with more bedrock knowledge since I have not really dealt with it at all before.

@tylerkaraszewski tylerkaraszewski merged commit f65e4fc into main Sep 23, 2024
1 check passed
@tylerkaraszewski tylerkaraszewski deleted the tyler-check-leading-correct-time branch September 23, 2024 18:02
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