ClickHouse/tests/queries/0_stateless/01671_ddl_hang_timeout_long.sh

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

32 lines
1.0 KiB
Bash
Raw Normal View History

2021-02-01 02:40:48 +00:00
#!/usr/bin/env bash
2021-09-12 12:35:27 +00:00
# Tags: long
2021-02-01 02:40:48 +00:00
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
2021-02-01 05:16:54 +00:00
# shellcheck source=../shell_config.sh
2021-02-01 02:40:48 +00:00
. "$CURDIR"/../shell_config.sh
2021-02-01 09:53:13 +00:00
function thread_create_drop_table {
while true; do
REPLICA=$(($RANDOM % 10))
$CLICKHOUSE_CLIENT --query "CREATE TABLE IF NOT EXISTS t1 (x UInt64, s Array(Nullable(String))) ENGINE = ReplicatedMergeTree('/clickhouse/tables/$CLICKHOUSE_TEST_ZOOKEEPER_PREFIX/test_01671', 'r_$REPLICA') order by x" 2>/dev/null
sleep 0.0$RANDOM
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS t1"
done
2021-02-01 02:40:48 +00:00
}
2021-02-01 09:53:13 +00:00
function thread_alter_table {
while true; do
$CLICKHOUSE_CLIENT --query "ALTER TABLE $CLICKHOUSE_DATABASE.t1 on cluster test_shard_localhost ADD COLUMN newcol UInt32" >/dev/null 2>&1
sleep 0.0$RANDOM
done
2021-02-01 02:40:48 +00:00
}
2021-02-01 09:53:13 +00:00
2021-02-01 02:40:48 +00:00
export -f thread_create_drop_table
export -f thread_alter_table
timeout 20 bash -c "thread_create_drop_table" &
timeout 20 bash -c 'thread_alter_table' &
2021-02-01 02:40:48 +00:00
wait
sleep 1
2021-02-01 09:53:13 +00:00
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS t1";