Do not depend on the response of getInfo for increasing the RealTimeMicroseconds

This commit is contained in:
Alejandro 2024-08-29 08:43:01 +01:00
parent 91724c29a4
commit 88c99fa063

View File

@ -399,9 +399,14 @@ void logQueryFinish(
/// Update performance counters before logging to query_log /// Update performance counters before logging to query_log
CurrentThread::finalizePerformanceCounters(); CurrentThread::finalizePerformanceCounters();
QueryStatusInfo info = process_list_elem->getInfo(true, context->getSettingsRef().log_profile_events); std::shared_ptr<ProfileEvents::Counters::Snapshot> profile_counters;
elem.type = QueryLogElementType::QUERY_FINISH; QueryStatusInfo info = process_list_elem->getInfo(true, true);
if (context->getSettingsRef().log_profile_events)
profile_counters = info.profile_counters;
else
profile_counters.swap(info.profile_counters);
elem.type = QueryLogElementType::QUERY_FINISH;
addStatusInfoToQueryLogElement(elem, info, query_ast, context); addStatusInfoToQueryLogElement(elem, info, query_ast, context);
if (pulling_pipeline) if (pulling_pipeline)
@ -420,13 +425,7 @@ void logQueryFinish(
{ {
Progress p; Progress p;
p.incrementPiecewiseAtomically(Progress{ResultProgress{elem.result_rows, elem.result_bytes}}); p.incrementPiecewiseAtomically(Progress{ResultProgress{elem.result_rows, elem.result_bytes}});
p.incrementRealTimeMicroseconds((*profile_counters)[ProfileEvents::RealTimeMicroseconds]);
if (info.profile_counters)
{
UInt64 real_time_microseconds = (*info.profile_counters)[ProfileEvents::RealTimeMicroseconds];
p.incrementRealTimeMicroseconds(real_time_microseconds);
}
progress_callback(p); progress_callback(p);
} }