Fix resharding cleanup datarace with update queue#9014
Merged
Conversation
ffuugoo
approved these changes
May 21, 2026
generall
pushed a commit
that referenced
this pull request
May 22, 2026
* Add test to show cleanup may conflict with update queue * When invoking clean task, first wait for current update queue * Don't hold shard holder lock for a long time * Also assert the clean task finished completely
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two systems conflict:
During resharding up, we copy a portion of points from all existing shards into a new shard. We leave them in place for some time to prevent read consistency problems. At the end of resharding we delete these moved points as they don't belong in the old shard anymore.
Together with the update queue system this allows a data race. Queued operations are not cleared. But, these queued operations may still create/update points that don't belong in the shard anymore. So, after clearing old points is finished the same old points may land in the shard again from the update queue.
This PR adds a test to assert this behavior. It fixes the problem by making every clear operation wait for the current update queue to be applied with sort of a plunger operation. The test fails before the fix, and succeeds with the fix.
All Submissions:
devbranch (notmaster) and my branch was created fromdev.New Feature Submissions:
cargo +nightly fmt --allcommand prior to submission?cargo clippy --workspace --all-featurescommand?Changes to Core Features: