-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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 00975_move_partition_merge_tree #30717
Conversation
…eTree" This reverts commit e9ce859.
auto lock1 = lockForShare(local_context->getCurrentQueryId(), local_context->getSettingsRef().lock_acquire_timeout); | ||
auto lock2 = dest_table->lockForShare(local_context->getCurrentQueryId(), local_context->getSettingsRef().lock_acquire_timeout); | ||
auto merges_blocker = stopMergesAndWait(); |
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.
Thank you!
P.S. I though that this will be too much... And by some reason I though that holding currently_processing_in_background_mutex
was enough, which is obviously is incorrect, since new part will be commited only when it will be written/renamed.
src/Storages/StorageMergeTree.cpp
Outdated
@@ -1470,6 +1468,7 @@ void StorageMergeTree::movePartitionToTable(const StoragePtr & dest_table, const | |||
transaction.commit(&lock); | |||
} | |||
|
|||
clearOldMutations(true); |
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.
BTW it seems that this is redundant? (I see that it comes from reverting my patch initially, but maybe it should be removed?)
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.
Agree
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.
They will be cleared in the background.
Test fixed here #30723 |
src/Storages/StorageMergeTree.cpp
Outdated
@@ -1470,6 +1468,7 @@ void StorageMergeTree::movePartitionToTable(const StoragePtr & dest_table, const | |||
transaction.commit(&lock); | |||
} | |||
|
|||
clearOldMutations(true); |
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.
They will be cleared in the background.
AST fuzzer (MSan) - #30756 |
Backport #30717 to 21.10: Fix 00975_move_partition_merge_tree
Backport #30717 to 21.8: Fix 00975_move_partition_merge_tree
Backport #30717 to 21.9: Fix 00975_move_partition_merge_tree
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fixed a race condition between
REPLACE/MOVE PARTITION
and background merge in non-replicatedMergeTree
that might cause a part of moved/replaced data to remain in partition. Fixes #29327.Detailed description / Documentation draft:
Previous fix was incorrect, because locking
currently_processing_in_background_mutex
does not cancel already started merges (and does not fix similar issue with replace partition).