Fix race between mergeSelectingTask and queue reinitialization#34096
Merged
Fix race between mergeSelectingTask and queue reinitialization#34096
Conversation
azat
reviewed
Jan 28, 2022
Member
azat
left a comment
There was a problem hiding this comment.
Thanks, now everything is clear!
Member
Author
|
Stateless tests (thread, actions) [1/3] - race in |
This was referenced Jan 31, 2022
Closed
Merged
Closed
Merged
robot-clickhouse
pushed a commit
that referenced
this pull request
Jan 31, 2022
…ue reinitialization
tavplubix
added a commit
that referenced
this pull request
Feb 1, 2022
Backport #34096 to 22.1: Fix race between mergeSelectingTask and queue reinitialization
tavplubix
added a commit
that referenced
this pull request
Feb 1, 2022
Backport #34096 to 21.12: Fix race between mergeSelectingTask and queue reinitialization
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.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fixed minor race condition that might cause "intersecting parts" error in extremely rare cases after ZooKeeper connection loss.
Detailed description:
https://s3.amazonaws.com/clickhouse-test-reports/33665/16adcc166608b922f7351a8eedcfb483d63d7513/stress_test__debug__actions_.html
See also #34013
Connection was lost on attempt to update log_pointer. Log pointer was successfully updated in ZooKeeper, but
queue-0000000020was not added into in-memory queue.It's not a problem, because
queue-0000000020was reloaded from queue later when connection was restored:But
mergeSelectingTaskwas executed before queue reinitialization has finished:It constructed
ReplicatedMergeTreeMergePredicatethat calledpullLogsToQueue, but it was a noop, becausequeue-0000000020entry already present in the queue in ZooKeeper (but it does not present in in-memory queue and that's whyqueue.virtual_partsandmerges_versionwere not consistent).This bug was introduced in #32140 and was partially fixed in #32389, but I forgot about another similar case.
Related to #26876.