mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Merge pull request #39132 from ClickHouse/fix-data-race-in-completed-pipeline-executor
Fix data race in CompletedPipelineExecutor.
This commit is contained in:
commit
4f8cc871eb
@ -72,9 +72,11 @@ void CompletedPipelineExecutor::execute()
|
||||
data->executor = std::make_shared<PipelineExecutor>(pipeline.processors, pipeline.process_list_element);
|
||||
data->executor->setReadProgressCallback(pipeline.getReadProgressCallback());
|
||||
|
||||
auto func = [&, thread_group = CurrentThread::getGroup()]()
|
||||
/// Avoid passing this to labmda, copy ptr to data instead.
|
||||
/// Destructor of unique_ptr copy raw ptr into local variable first, only then calls object destructor.
|
||||
auto func = [data_ptr = data.get(), num_threads = pipeline.getNumThreads(), thread_group = CurrentThread::getGroup()]()
|
||||
{
|
||||
threadFunction(*data, thread_group, pipeline.getNumThreads());
|
||||
threadFunction(*data_ptr, thread_group, num_threads);
|
||||
};
|
||||
|
||||
data->thread = ThreadFromGlobalPool(std::move(func));
|
||||
|
Loading…
Reference in New Issue
Block a user