mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 21:51:57 +00:00
7d1ef764c2
Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
60 lines
1.7 KiB
Bash
Executable File
60 lines
1.7 KiB
Bash
Executable File
#!/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 numbers_mt(10000) WHERE rand() = 0 FORMAT Null";
|
|
done
|
|
}
|
|
|
|
function thread_cancel()
|
|
{
|
|
while true; do
|
|
$CLICKHOUSE_CLIENT --query "KILL QUERY WHERE current_database = '$CLICKHOUSE_DATABASE' 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
|