Change threadpool code to old style

(cherry picked from commit 3738191edd)
This commit is contained in:
Кирилл Гарбар 2024-10-09 12:52:18 +03:00 committed by alesapin
parent bc01b2b07a
commit 227761b22f

View File

@ -1973,7 +1973,8 @@ void MergeTreeData::loadUnexpectedDataParts()
}
ThreadFuzzer::maybeInjectSleep();
ThreadPoolCallbackRunnerLocal<void> runner(getUnexpectedPartsLoadingThreadPool().get(), "UnexpectedParts");
auto runner = threadPoolCallbackRunner<void>(getUnexpectedPartsLoadingThreadPool().get(), "UnexpectedParts");
std::vector<std::future<void>> parts_futures;
for (auto & load_state : unexpected_data_parts)
{
@ -1981,10 +1982,10 @@ void MergeTreeData::loadUnexpectedDataParts()
chassert(!load_state.part);
if (unexpected_data_parts_loading_canceled)
{
runner.waitForAllToFinishAndRethrowFirstError();
waitForAllToFinishAndRethrowFirstError(parts_futures);
return;
}
runner([&]()
parts_futures.push_back(runner([&]()
{
loadUnexpectedDataPart(load_state);
@ -1993,9 +1994,9 @@ void MergeTreeData::loadUnexpectedDataParts()
{
load_state.part->renameToDetached("broken-on-start"); /// detached parts must not have '_' in prefixes
}
}, Priority{});
}, Priority{}));
}
runner.waitForAllToFinishAndRethrowFirstError();
waitForAllToFinishAndRethrowFirstError(parts_futures);
LOG_DEBUG(log, "Loaded {} unexpected data parts", unexpected_data_parts.size());
{