mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Merge pull request #29364 from azat/benchmark-fix-query_id
Pass through initial query_id for clickhouse-benchmark
This commit is contained in:
commit
07eef92c16
@ -208,6 +208,12 @@ void RemoteQueryExecutor::sendQuery()
|
||||
auto timeouts = ConnectionTimeouts::getTCPTimeoutsWithFailover(settings);
|
||||
ClientInfo modified_client_info = context->getClientInfo();
|
||||
modified_client_info.query_kind = ClientInfo::QueryKind::SECONDARY_QUERY;
|
||||
/// Set initial_query_id to query_id for the clickhouse-benchmark.
|
||||
///
|
||||
/// (since first query of clickhouse-benchmark will be issued as SECONDARY_QUERY,
|
||||
/// due to it executes queries via RemoteBlockInputStream)
|
||||
if (modified_client_info.initial_query_id.empty())
|
||||
modified_client_info.initial_query_id = query_id;
|
||||
if (CurrentThread::isInitialized())
|
||||
{
|
||||
modified_client_info.client_trace_context = CurrentThread::get().thread_trace_context;
|
||||
|
@ -0,0 +1 @@
|
||||
3
|
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
query_id="${CLICKHOUSE_DATABASE}_$$"
|
||||
benchmark_args=(
|
||||
--iterations 1
|
||||
--log_queries 1
|
||||
--query_id "$query_id"
|
||||
--log_queries_min_type QUERY_FINISH
|
||||
)
|
||||
$CLICKHOUSE_BENCHMARK "${benchmark_args[@]}" --query "SELECT * FROM remote('127.2', 'system.one')" >& /dev/null
|
||||
$CLICKHOUSE_CLIENT -q "SYSTEM FLUSH LOGS"
|
||||
# Number of queries:
|
||||
# - DESC TABLE system.one
|
||||
# - query on initiator
|
||||
# - query on shard
|
||||
# Total: 3
|
||||
#
|
||||
# -- NOTE: this test cannot use 'current_database = $CLICKHOUSE_DATABASE',
|
||||
# -- because it does not propagated via remote queries,
|
||||
# -- but it uses query_id, and this is enough.
|
||||
$CLICKHOUSE_CLIENT --param_query_id="$query_id" -q "SELECT count() FROM system.query_log WHERE event_date >= yesterday() AND initial_query_id = {query_id:String}"
|
Loading…
Reference in New Issue
Block a user