mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Merge pull request #10784 from ClickHouse/fix-queue-race-condition
Fix race condition in ReplicatedMergeTreeQueue
This commit is contained in:
commit
961603b111
@ -2954,6 +2954,7 @@ void StorageReplicatedMergeTree::startup()
|
||||
/// If we don't separate create/start steps, race condition will happen
|
||||
/// between the assignment of queue_task_handle and queueTask that use the queue_task_handle.
|
||||
{
|
||||
auto lock = queue.lockQueue();
|
||||
auto & pool = global_context.getBackgroundPool();
|
||||
queue_task_handle = pool.createTask([this] { return queueTask(); });
|
||||
pool.startTask(queue_task_handle);
|
||||
@ -2993,7 +2994,6 @@ void StorageReplicatedMergeTree::shutdown()
|
||||
queue_task_handle.reset();
|
||||
}
|
||||
|
||||
|
||||
if (move_parts_task_handle)
|
||||
global_context.getBackgroundMovePool().removeTask(move_parts_task_handle);
|
||||
move_parts_task_handle.reset();
|
||||
|
Loading…
Reference in New Issue
Block a user