mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 13:42:02 +00:00
fix possible dataraces in ReplicatedMergeTree
This commit is contained in:
parent
0e9cad2276
commit
13e2034084
@ -5106,19 +5106,20 @@ void StorageReplicatedMergeTree::movePartitionToTable(const StoragePtr & dest_ta
|
||||
|
||||
Transaction transaction(*dest_table_storage);
|
||||
{
|
||||
auto data_parts_lock = lockParts();
|
||||
auto dest_data_parts_lock = dest_table_storage->lockParts();
|
||||
|
||||
for (MutableDataPartPtr & part : dst_parts)
|
||||
dest_table_storage->renameTempPartAndReplace(part, nullptr, &transaction, data_parts_lock);
|
||||
dest_table_storage->renameTempPartAndReplace(part, nullptr, &transaction, dest_data_parts_lock);
|
||||
}
|
||||
|
||||
op_results = zookeeper->multi(ops);
|
||||
|
||||
{
|
||||
auto data_parts_lock = lockParts();
|
||||
auto src_data_parts_lock = lockParts();
|
||||
auto dest_data_parts_lock = dest_table_storage->lockParts();
|
||||
|
||||
transaction.commit(&data_parts_lock);
|
||||
parts_to_remove = removePartsInRangeFromWorkingSet(drop_range, true, false, data_parts_lock);
|
||||
transaction.commit(&src_data_parts_lock);
|
||||
parts_to_remove = removePartsInRangeFromWorkingSet(drop_range, true, false, src_data_parts_lock);
|
||||
}
|
||||
|
||||
PartLog::addNewParts(global_context, dst_parts, watch.elapsed());
|
||||
|
Loading…
Reference in New Issue
Block a user