diff --git a/src/Storages/MergeTree/ReplicatedMergeTreeRestartingThread.cpp b/src/Storages/MergeTree/ReplicatedMergeTreeRestartingThread.cpp index dfb5eb0bd69..11f668bafbe 100644 --- a/src/Storages/MergeTree/ReplicatedMergeTreeRestartingThread.cpp +++ b/src/Storages/MergeTree/ReplicatedMergeTreeRestartingThread.cpp @@ -151,13 +151,13 @@ bool ReplicatedMergeTreeRestartingThread::runImpl() setNotReadonly(); /// Start queue processing - storage.part_check_thread.start(); storage.background_operations_assignee.start(); storage.queue_updating_task->activateAndSchedule(); storage.mutations_updating_task->activateAndSchedule(); storage.mutations_finalizing_task->activateAndSchedule(); storage.merge_selecting_task->activateAndSchedule(); storage.cleanup_thread.start(); + storage.part_check_thread.start(); return true; } @@ -356,6 +356,7 @@ void ReplicatedMergeTreeRestartingThread::partialShutdown(bool part_of_full_shut storage.mutations_finalizing_task->deactivate(); storage.cleanup_thread.stop(); + storage.part_check_thread.stop(); /// Stop queue processing { @@ -365,9 +366,6 @@ void ReplicatedMergeTreeRestartingThread::partialShutdown(bool part_of_full_shut storage.background_operations_assignee.finish(); } - /// Stop part_check_thread after queue processing, because some queue tasks may restart part_check_thread - storage.part_check_thread.stop(); - LOG_TRACE(log, "Threads finished"); }