mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Merge pull request #13201 from azat/fix-logging-in-MergeTreeDataSelectExecutor
Fix logging in MergeTreeDataSelectExecutor for multiple threads (attach to thread group)
This commit is contained in:
commit
cf49a83980
@ -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();
|
||||
}
|
||||
@ -1343,7 +1353,7 @@ MarkRanges MergeTreeDataSelectExecutor::markRangesFromPKRange(
|
||||
/// If index is not used.
|
||||
if (key_condition.alwaysUnknownOrTrue())
|
||||
{
|
||||
LOG_TRACE(log, "Not using index on part {}", part->name);
|
||||
LOG_TRACE(log, "Not using primary index on part {}", part->name);
|
||||
|
||||
if (has_final_mark)
|
||||
res.push_back(MarkRange(0, marks_count - 1));
|
||||
|
@ -9,11 +9,11 @@ set log_queries = 1;
|
||||
select x from table_01323_many_parts limit 10 format Null;
|
||||
|
||||
system flush logs;
|
||||
select length(thread_ids) <= 4 from system.query_log where event_date >= today() - 1 and lower(query) like '%select x from table_01323_many_parts%' and type = 'QueryFinish' order by query_start_time desc limit 1;
|
||||
select arrayUniq(thread_ids) <= 4 from system.query_log where event_date >= today() - 1 and query ilike '%select x from table_01323_many_parts%' and query not like '%system.query_log%' and type = 'QueryFinish' order by query_start_time desc limit 1;
|
||||
|
||||
select x from table_01323_many_parts order by x limit 10 format Null;
|
||||
|
||||
system flush logs;
|
||||
select length(thread_ids) <= 20 from system.query_log where event_date >= today() - 1 and lower(query) like '%select x from table_01323_many_parts order by x%' and type = 'QueryFinish' order by query_start_time desc limit 1;
|
||||
select arrayUniq(thread_ids) <= 36 from system.query_log where event_date >= today() - 1 and query ilike '%select x from table_01323_many_parts order by x%' and query not like '%system.query_log%' and type = 'QueryFinish' order by query_start_time desc limit 1;
|
||||
|
||||
drop table if exists table_01323_many_parts;
|
||||
|
Loading…
Reference in New Issue
Block a user