mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge pull request #10986 from ClickHouse/try-fix-use-after-free-mergetree
Try to fix use-after-free error in MergeTree
This commit is contained in:
commit
073dc2e1e3
@ -93,9 +93,18 @@ void StorageMergeTree::startup()
|
||||
|
||||
/// NOTE background task will also do the above cleanups periodically.
|
||||
time_after_previous_cleanup.restart();
|
||||
merging_mutating_task_handle = global_context.getBackgroundPool().addTask([this] { return mergeMutateTask(); });
|
||||
|
||||
auto & merge_pool = global_context.getBackgroundPool();
|
||||
merging_mutating_task_handle = merge_pool.createTask([this] { return mergeMutateTask(); });
|
||||
/// Ensure that thread started only after assignment to 'merging_mutating_task_handle' is done.
|
||||
merge_pool.startTask(merging_mutating_task_handle);
|
||||
|
||||
if (areBackgroundMovesNeeded())
|
||||
moving_task_handle = global_context.getBackgroundMovePool().addTask([this] { return movePartsTask(); });
|
||||
{
|
||||
auto & move_pool = global_context.getBackgroundMovePool();
|
||||
moving_task_handle = move_pool.createTask([this] { return movePartsTask(); });
|
||||
move_pool.startTask(moving_task_handle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user