mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 13:32:13 +00:00
fix data race in prewarmCaches when thread is failed to allocate
This commit is contained in:
parent
bc79653eed
commit
c512c23c26
@ -2405,8 +2405,6 @@ void MergeTreeData::prewarmCaches(ThreadPool & pool, MarkCachePtr mark_cache, Pr
|
||||
return to_tuple(lhs) > to_tuple(rhs);
|
||||
});
|
||||
|
||||
ThreadPoolCallbackRunnerLocal<void> runner(pool, "PrewarmCaches");
|
||||
|
||||
double marks_ratio_to_prewarm = getContext()->getServerSettings()[ServerSetting::mark_cache_prewarm_ratio];
|
||||
double index_ratio_to_prewarm = getContext()->getServerSettings()[ServerSetting::primary_index_cache_prewarm_ratio];
|
||||
|
||||
@ -2418,6 +2416,10 @@ void MergeTreeData::prewarmCaches(ThreadPool & pool, MarkCachePtr mark_cache, Pr
|
||||
columns_to_prewarm_marks = getColumnsToPrewarmMarks(*getSettings(), metadata_snaphost->getColumns().getAllPhysical());
|
||||
}
|
||||
|
||||
/// Allocate runner on stack after all used local variables to make its destructor
|
||||
/// is called first and all tasks stopped before local variables are being destroyed.
|
||||
ThreadPoolCallbackRunnerLocal<void> runner(pool, "PrewarmCaches");
|
||||
|
||||
for (const auto & part : data_parts)
|
||||
{
|
||||
bool added_task = false;
|
||||
|
Loading…
Reference in New Issue
Block a user