Made test for KILL QUERY more deterministic. [#CLICKHOUSE-2120] [resloved #283]

This commit is contained in:
Vitaliy Lyudvichenko 2017-01-28 02:23:37 +03:00
parent ff54b9466d
commit 7f73f91705
2 changed files with 9 additions and 9 deletions

View File

@ -1,6 +1,6 @@
SELECT sleep(1) FROM system.numbers LIMIT 6
SELECT sleep(2) FROM system.numbers LIMIT 3
SELECT sleep(3) FROM system.numbers LIMIT 2
SELECT sleep(2) FROM system.numbers LIMIT 4
SELECT sleep(3) FROM system.numbers LIMIT 3
SELECT sleep(4) FROM system.numbers LIMIT 2
0
SELECT sleep(1) FROM system.numbers LIMIT 999
0

View File

@ -3,12 +3,12 @@ set -e
QUERY_FIELND_NUM=4
# should be quite deterministic
clickhouse-client --max_block_size=1 -q "SELECT sleep(3) FROM system.numbers LIMIT 2" &>/dev/null &
clickhouse-client --max_block_size=1 -q "SELECT sleep(1) FROM system.numbers LIMIT 6" &>/dev/null &
clickhouse-client --max_block_size=1 -q "SELECT sleep(2) FROM system.numbers LIMIT 3" &>/dev/null &
clickhouse-client --max_block_size=1 -q "SELECT 'trash', sleep(2) FROM system.numbers LIMIT 3" &>/dev/null &
sleep 1 # wait initialization
# Sleep sort. Should be quite deterministic
clickhouse-client --max_block_size=1 -q "SELECT sleep(4) FROM system.numbers LIMIT 2" &>/dev/null &
clickhouse-client --max_block_size=1 -q "SELECT sleep(2) FROM system.numbers LIMIT 4" &>/dev/null &
clickhouse-client --max_block_size=1 -q "SELECT sleep(3) FROM system.numbers LIMIT 3" &>/dev/null &
clickhouse-client --max_block_size=1 -q "SELECT 'trash', sleep(2) FROM system.numbers LIMIT 4" &>/dev/null &
sleep 1 # here we need wait 1 sec for init, therefore minimum "sorting element" should be greater than 1 sec (i.e. 2 sec)
clickhouse-client -q "KILL QUERY WHERE query LIKE 'SELECT sleep(%' AND (elapsed >= 0.) SYNC" | cut -f $QUERY_FIELND_NUM
clickhouse-client -q "SELECT countIf(query LIKE 'SELECT sleep(%') FROM system.processes"