mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
fixup
This commit is contained in:
parent
852ee7e26a
commit
0cdb6f8c78
@ -1 +1,3 @@
|
||||
OK
|
||||
Started
|
||||
Sent kill request
|
||||
Exit 138
|
||||
|
@ -10,32 +10,24 @@ set -e -o pipefail
|
||||
query_id="01572_kill_window_function"
|
||||
$CLICKHOUSE_CLIENT --query_id="$query_id" --query "SELECT count(1048575) OVER (PARTITION BY intDiv(NULL, number) ORDER BY number DESC NULLS FIRST ROWS BETWEEN CURRENT ROW AND 1048575 FOLLOWING) FROM numbers(255, 1048575)" >/dev/null 2>&1 &
|
||||
client_pid=$!
|
||||
echo Started
|
||||
|
||||
# First check that clickhouse-client is still alive, and then use one query to
|
||||
# both kill the test query and verify that it has started.
|
||||
# If we try to kill it before it starts, the test will fail.
|
||||
# If it finishes after we check it started, the test will fail.
|
||||
# That's why it is better to check and kill with the same call.
|
||||
while kill -0 $client_pid \
|
||||
&& [ -z "$(CLICKHOUSE_CLIENT --query "kill query where query_id = '$query_id' and current_database = currentDatabase()")" ]
|
||||
# Use one query to both kill the test query and verify that it has started,
|
||||
# because if we try to kill it before it starts, the test will fail.
|
||||
while [ -z "$($CLICKHOUSE_CLIENT --query "kill query where query_id = '$query_id' and current_database = currentDatabase()")" ]
|
||||
do
|
||||
# If we don't yet see the query in the process list, the client should still
|
||||
# be running. The query is very long.
|
||||
kill -0 -- $client_pid
|
||||
sleep 1
|
||||
done
|
||||
echo Sent kill request
|
||||
|
||||
# Wait for the client to terminate.
|
||||
client_exit_code=0
|
||||
wait $client_pid || client_exit_code=$?
|
||||
|
||||
# Note that we still have to check for normal termination, because the test query
|
||||
# might have completed even before we first tried to kill it. This shouldn't
|
||||
# really happen because it's very long, but our CI infractructure is known to
|
||||
# introduce the most unexpected delays.
|
||||
if [ $client_exit_code -eq 0 ] || [ $client_exit_code -eq 138 ]
|
||||
then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Got unexpected client exit code $client_exit_code"
|
||||
fi
|
||||
echo "Exit $client_exit_code"
|
||||
|
||||
# We have tested for Ctrl+C.
|
||||
# The following client flags don't cancel, but should: --max_execution_time,
|
||||
|
Loading…
Reference in New Issue
Block a user