ClickHouse/tests/queries/0_stateless/02867_storage_set_tsan.sh
Alexey Milovidov bbd67d262a Merging #52352
2023-10-14 02:52:53 +02:00

43 lines
943 B
Bash
Executable File

#!/usr/bin/env bash
# Tags: race, no-debug
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
$CLICKHOUSE_CLIENT -mn -q """
DROP TABLE IF EXISTS t1_02867;
CREATE TABLE t1_02867 (x UInt64) ENGINE=Set();
"""
function repeat_select() {
n=0
while [ "$n" -lt 20 ];
do
n=$(( n + 1 ))
$CLICKHOUSE_CLIENT -q "SELECT count() as a FROM numbers(10) WHERE number IN t1_02867" > /dev/null 2> /dev/null || exit
done
}
function repeat_truncate_insert() {
n=0
while [ "$n" -lt 20 ];
do
n=$(( n + 1 ))
$CLICKHOUSE_CLIENT -q "TRUNCATE t1_02867;" > /dev/null 2> /dev/null || exit
done
}
repeat_select &
repeat_truncate_insert &
repeat_select &
repeat_truncate_insert &
repeat_select &
repeat_truncate_insert &
repeat_select &
repeat_truncate_insert &
sleep 10
$CLICKHOUSE_CLIENT -mn -q "DROP TABLE IF EXISTS t1_02867;"