Fix printing ProfileEvents on client for multiple queries

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2022-04-11 17:42:45 +03:00
parent d46eaadacc
commit 1fa3e6a426
3 changed files with 8 additions and 0 deletions

View File

@ -1413,6 +1413,8 @@ void ClientBase::processParsedSingleQuery(const String & full_query, const Strin
progress_indication.clearProgressOutput();
logs_out_stream->writeProfileEvents(profile_events.last_block);
logs_out_stream->flush();
profile_events.last_block = {};
}
if (is_interactive)

View File

@ -6,3 +6,5 @@ print everything
OK
print each 100 ms
OK
check that ProfileEvents is new for each query
OK

View File

@ -17,3 +17,7 @@ test "$profile_events" -gt 1 && echo OK || echo "FAIL ($profile_events)"
echo 'print each 100 ms'
profile_events="$($CLICKHOUSE_CLIENT --max_block_size 1 --print-profile-events --profile-events-delay-ms=100 -q 'select sleep(1) from numbers(2) format Null' |& grep -c 'SelectedRows')"
test "$profile_events" -gt 1 && echo OK || echo "FAIL ($profile_events)"
echo 'check that ProfileEvents is new for each query'
sleep_function_calls=$($CLICKHOUSE_CLIENT --print-profile-events --profile-events-delay-ms=-1 -n -q 'select sleep(1); select 1' |& grep -c 'SleepFunctionCalls')
test "$sleep_function_calls" -eq 1 && echo OK || echo "FAIL ($sleep_function_calls)"