ClickHouse/tests/queries/0_stateless/02461_cancel_finish_race.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

60 lines
1.7 KiB
Bash
Raw Normal View History

2022-10-17 00:34:33 +00:00
#!/usr/bin/env bash
# Tags: no-fasttest
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
function thread_query()
{
while true; do
$CLICKHOUSE_CLIENT --query "SELECT count() FROM system.numbers_mt WHERE rand() = 0 FORMAT Null";
done
}
function thread_cancel()
{
while true; do
$CLICKHOUSE_CLIENT --query "KILL QUERY WHERE 1 SYNC FORMAT Null";
done
}
# https://stackoverflow.com/questions/9954794/execute-a-shell-function-with-timeout
export -f thread_query;
export -f thread_cancel;
TIMEOUT=30
timeout $TIMEOUT bash -c thread_query 2> /dev/null &
timeout $TIMEOUT bash -c thread_cancel 2> /dev/null &
timeout $TIMEOUT bash -c thread_query 2> /dev/null &
timeout $TIMEOUT bash -c thread_cancel 2> /dev/null &
timeout $TIMEOUT bash -c thread_query 2> /dev/null &
timeout $TIMEOUT bash -c thread_cancel 2> /dev/null &
timeout $TIMEOUT bash -c thread_query 2> /dev/null &
timeout $TIMEOUT bash -c thread_cancel 2> /dev/null &
timeout $TIMEOUT bash -c thread_query 2> /dev/null &
timeout $TIMEOUT bash -c thread_cancel 2> /dev/null &
timeout $TIMEOUT bash -c thread_query 2> /dev/null &
timeout $TIMEOUT bash -c thread_cancel 2> /dev/null &
timeout $TIMEOUT bash -c thread_query 2> /dev/null &
timeout $TIMEOUT bash -c thread_cancel 2> /dev/null &
timeout $TIMEOUT bash -c thread_query 2> /dev/null &
timeout $TIMEOUT bash -c thread_cancel 2> /dev/null &
timeout $TIMEOUT bash -c thread_query 2> /dev/null &
timeout $TIMEOUT bash -c thread_cancel 2> /dev/null &
timeout $TIMEOUT bash -c thread_query 2> /dev/null &
timeout $TIMEOUT bash -c thread_cancel 2> /dev/null &
wait