mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Merge pull request #58560 from vitlibar/fix-test-02932_kill_query_sleep
Fix test 02932_kill_query_sleep
This commit is contained in:
commit
ef1e50091d
@ -8,18 +8,31 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
function wait_query_started()
|
||||
{
|
||||
local query_id="$1"
|
||||
$CLICKHOUSE_CLIENT --query "SYSTEM FLUSH LOGS"
|
||||
while [[ $($CLICKHOUSE_CLIENT --query="SELECT count() FROM system.query_log WHERE query_id='$query_id' AND current_database = currentDatabase()") == 0 ]]; do
|
||||
sleep 0.1;
|
||||
$CLICKHOUSE_CLIENT --query "SYSTEM FLUSH LOGS;"
|
||||
timeout=60
|
||||
start=$EPOCHSECONDS
|
||||
while [[ $($CLICKHOUSE_CLIENT --query="SELECT count() FROM system.processes WHERE query_id='$query_id'") == 0 ]]; do
|
||||
if ((EPOCHSECONDS-start > timeout )); then
|
||||
echo "Timeout while waiting for query $query_id to start"
|
||||
exit 1
|
||||
fi
|
||||
sleep 0.1
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function kill_query()
|
||||
{
|
||||
local query_id="$1"
|
||||
$CLICKHOUSE_CLIENT --query "KILL QUERY WHERE query_id='$query_id'" >/dev/null
|
||||
while [[ $($CLICKHOUSE_CLIENT --query="SELECT count() FROM system.processes WHERE query_id='$query_id'") != 0 ]]; do sleep 0.1; done
|
||||
timeout=60
|
||||
start=$EPOCHSECONDS
|
||||
while [[ $($CLICKHOUSE_CLIENT --query="SELECT count() FROM system.processes WHERE query_id='$query_id'") != 0 ]]; do
|
||||
if ((EPOCHSECONDS-start > timeout )); then
|
||||
echo "Timeout while waiting for query $query_id to cancel"
|
||||
exit 1
|
||||
fi
|
||||
sleep 0.1
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user