ClickHouse/tests/queries/0_stateless/01320_create_sync_race_condition.sh

29 lines
617 B
Bash
Raw Normal View History

2020-06-15 23:04:12 +00:00
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
2020-08-01 00:51:12 +00:00
. "$CURDIR"/../shell_config.sh
2020-06-15 23:04:12 +00:00
set -e
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS r;"
function thread1()
{
while true; do $CLICKHOUSE_CLIENT -n --query "CREATE TABLE r (x UInt64) ENGINE = ReplicatedMergeTree('/test/table', 'r') ORDER BY x; DROP TABLE r;"; done
}
function thread2()
{
while true; do $CLICKHOUSE_CLIENT --query "SYSTEM SYNC REPLICA r" 2>/dev/null; done
}
export -f thread1
export -f thread2
timeout 10 bash -c thread1 &
timeout 10 bash -c thread2 &
wait
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS r;"