mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-22 17:50:47 +00:00
Fix logging in MergeTreeDataSelectExecutor for multiple threads (attach to thread group)
This commit is contained in:
parent
101217470e
commit
e37c42c56c
@ -1,4 +1,5 @@
|
||||
#include <boost/rational.hpp> /// For calculations related to sampling coefficients.
|
||||
#include <ext/scope_guard.h>
|
||||
#include <optional>
|
||||
|
||||
#include <Poco/File.h>
|
||||
@ -613,7 +614,16 @@ Pipes MergeTreeDataSelectExecutor::readFromParts(
|
||||
ThreadPool pool(num_threads);
|
||||
|
||||
for (size_t part_index = 0; part_index < parts.size(); ++part_index)
|
||||
pool.scheduleOrThrowOnError([&, part_index] { process_part(part_index); });
|
||||
pool.scheduleOrThrowOnError([&, part_index, thread_group = CurrentThread::getGroup()] {
|
||||
SCOPE_EXIT(
|
||||
if (thread_group)
|
||||
CurrentThread::detachQueryIfNotDetached();
|
||||
);
|
||||
if (thread_group)
|
||||
CurrentThread::attachTo(thread_group);
|
||||
|
||||
process_part(part_index);
|
||||
});
|
||||
|
||||
pool.wait();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user