2023-03-02 19:25:50 +00:00
#!/usr/bin/env bash
CURDIR = $( cd " $( dirname " ${ BASH_SOURCE [0] } " ) " && pwd )
# shellcheck source=../shell_config.sh
. " $CURDIR " /../shell_config.sh
QUERY_ID = " ${ CLICKHOUSE_DATABASE } _test_02585_query_to_kill_id_1 "
$CLICKHOUSE_CLIENT --query_id= " $QUERY_ID " -n -q "
create temporary table tmp as select * from numbers( 500000000) ;
select * from remote( '127.0.0.2' , 'system.numbers_mt' ) where number in ( select * from tmp) ; " &> /dev/null &
2023-03-04 13:31:18 +00:00
$CLICKHOUSE_CLIENT -q "SYSTEM FLUSH LOGS"
2023-03-02 19:25:50 +00:00
while true
do
2023-06-13 14:50:43 +00:00
res = $( $CLICKHOUSE_CLIENT -q " select query, event_time from system.query_log where query_id = ' $QUERY_ID ' and current_database = ' $CLICKHOUSE_DATABASE ' and query like 'select%' limit 1 " )
2023-03-02 19:25:50 +00:00
if [ -n " $res " ] ; then
break
fi
sleep 1
done
$CLICKHOUSE_CLIENT -q " kill query where query_id = ' $QUERY_ID ' sync " & > /dev/null