2021-10-12 18:03:54 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
# shellcheck source=../shell_config.sh
|
|
|
|
. "$CURDIR"/../shell_config.sh
|
|
|
|
|
2022-04-12 17:18:27 +00:00
|
|
|
echo 'do not print any ProfileEvents packets'
|
2021-10-12 18:03:54 +00:00
|
|
|
$CLICKHOUSE_CLIENT -q 'select * from numbers(1e5) format Null' |& grep -c 'SelectedRows'
|
2022-04-12 17:18:27 +00:00
|
|
|
|
|
|
|
echo 'print only last (and also number of rows to provide more info in case of failures)'
|
2022-04-12 17:38:16 +00:00
|
|
|
$CLICKHOUSE_CLIENT --max_block_size=65505 --print-profile-events --profile-events-delay-ms=-1 -q 'select * from numbers(1e5)' |& grep -o -e '\[ 0 \] SelectedRows: .*$' -e Exception
|
2022-04-12 17:18:27 +00:00
|
|
|
|
2022-04-12 16:51:39 +00:00
|
|
|
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 $?
|
|
|
|
|
2022-04-12 17:14:41 +00:00
|
|
|
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)'
|
|
|
|
|
2022-04-12 18:11:39 +00:00
|
|
|
echo 'regression test for overlap profile events snapshots between queries (clickhouse-local)'
|
|
|
|
$CLICKHOUSE_LOCAL --print-profile-events --profile-events-delay-ms=-1 -n -q 'select 1; select 1' |& grep -F -o '[ 0 ] SelectedRows: 1 (increment)'
|
|
|
|
|
2022-04-12 17:18:27 +00:00
|
|
|
echo 'print everything'
|
2021-12-14 07:25:30 +00:00
|
|
|
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)"
|
2022-04-12 17:18:27 +00:00
|
|
|
|
|
|
|
echo 'print each 100 ms'
|
2023-06-30 08:50:44 +00:00
|
|
|
profile_events="$($CLICKHOUSE_CLIENT --max_block_size 1 --print-profile-events --profile-events-delay-ms=100 -q 'select sleep(0.2) from numbers(10) format Null' |& grep -c 'SelectedRows')"
|
2021-12-14 07:25:30 +00:00
|
|
|
test "$profile_events" -gt 1 && echo OK || echo "FAIL ($profile_events)"
|
2022-04-11 14:42:45 +00:00
|
|
|
|
|
|
|
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)"
|