mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
Merge pull request #6001 from yandex/fixed-error-with-query-id-printing
Fixed error with query_id printing
This commit is contained in:
commit
37f9206925
@ -29,11 +29,10 @@ namespace ErrorCodes
|
||||
void ThreadStatus::attachQueryContext(Context & query_context_)
|
||||
{
|
||||
query_context = &query_context_;
|
||||
query_id = query_context->getCurrentQueryId();
|
||||
if (!global_context)
|
||||
global_context = &query_context->getGlobalContext();
|
||||
|
||||
query_id = query_context->getCurrentQueryId();
|
||||
|
||||
if (thread_group)
|
||||
{
|
||||
std::lock_guard lock(thread_group->mutex);
|
||||
@ -106,6 +105,9 @@ void ThreadStatus::attachQuery(const ThreadGroupStatusPtr & thread_group_, bool
|
||||
thread_group->thread_numbers.emplace_back(thread_number);
|
||||
}
|
||||
|
||||
if (query_context)
|
||||
query_id = query_context->getCurrentQueryId();
|
||||
|
||||
#if defined(__linux__)
|
||||
/// Set "nice" value if required.
|
||||
if (query_context)
|
||||
@ -269,7 +271,7 @@ void CurrentThread::attachQueryContext(Context & query_context)
|
||||
{
|
||||
if (unlikely(!current_thread))
|
||||
return;
|
||||
return current_thread->attachQueryContext(query_context);
|
||||
current_thread->attachQueryContext(query_context);
|
||||
}
|
||||
|
||||
void CurrentThread::finalizePerformanceCounters()
|
||||
|
9
dbms/tests/queries/0_stateless/00971_query_id_in_logs.sh
Executable file
9
dbms/tests/queries/0_stateless/00971_query_id_in_logs.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
. $CURDIR/../shell_config.sh
|
||||
|
||||
set -e
|
||||
|
||||
# No log lines without query id
|
||||
$CLICKHOUSE_CLIENT --send_logs_level=trace --query_id=hello --query="SELECT count() FROM numbers(10)" 2>&1 | grep -vF ' {hello} ' | grep -P '<\w+>' ||:
|
Loading…
Reference in New Issue
Block a user