-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Fix race condition between optimize and drop #9901
Conversation
Tsan report without fix:
|
queue_task_handle.reset(); | ||
|
||
{ | ||
/// Queue can trigger queue_task_handle itself. So we ensure that all |
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.
Maybe it's also possible with atomic flag?
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.
But how? Operations with the flag are atomic, but t1
can check the flag and it will say that pointer is OK then sleep for some time after that shutdown
thread t2
will be called and sets both flag and pointer to zero. After that t1
will wake up and call wake
on empty pointer.
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.
You're right.
Fix race condition between optimize and drop (cherry picked from commit e75cf7b)
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix race condition between drop and optimize in
ReplicatedMergeTree
.