Do not overlap profile events snapshots for queries

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2022-04-12 20:14:41 +03:00
parent e38057ddb0
commit 097e2f626d
3 changed files with 7 additions and 0 deletions

View File

@ -728,6 +728,7 @@ void TCPHandler::processOrdinaryQueryWithProcessors()
return;
sendData({});
last_sent_snapshots.clear();
}
sendProgress();

View File

@ -4,6 +4,9 @@ print only last (and also number of rows to provide more info in case of failure
[ 0 ] SelectedRows: 131010 (increment)
regression test for incorrect filtering out snapshots
0
regression test for overlap profile events snapshots between queries
[ 0 ] SelectedRows: 1 (increment)
[ 0 ] SelectedRows: 1 (increment)
print everything
OK
print each 100 ms

View File

@ -14,6 +14,9 @@ echo 'regression test for incorrect filtering out snapshots'
$CLICKHOUSE_CLIENT --print-profile-events --profile-events-delay-ms=-1 -n -q 'select 1; select 1' >& /dev/null
echo $?
echo 'regression test for overlap profile events snapshots between queries'
$CLICKHOUSE_CLIENT --print-profile-events --profile-events-delay-ms=-1 -n -q 'select 1; select 1' |& grep -F -o '[ 0 ] SelectedRows: 1 (increment)'
echo 'print everything'
profile_events="$($CLICKHOUSE_CLIENT --max_block_size 1 --print-profile-events -q 'select sleep(1) from numbers(2) format Null' |& grep -c 'SelectedRows')"
test "$profile_events" -gt 1 && echo OK || echo "FAIL ($profile_events)"