2022-11-14 20:53:29 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# Tags: long, zookeeper
|
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
# shellcheck source=../shell_config.sh
|
|
|
|
. "$CURDIR"/../shell_config.sh
|
|
|
|
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT -q "drop table if exists src;"
|
|
|
|
$CLICKHOUSE_CLIENT -q "create table src(A UInt64) Engine=ReplicatedMergeTree('/clickhouse/{database}/test/src1', '1') order by tuple() SETTINGS min_bytes_for_wide_part=0;"
|
|
|
|
$CLICKHOUSE_CLIENT -q "insert into src values (0)"
|
|
|
|
|
|
|
|
function thread()
|
|
|
|
{
|
2023-07-05 07:17:52 +00:00
|
|
|
local TIMELIMIT=$((SECONDS+$1))
|
2022-11-14 20:53:29 +00:00
|
|
|
for i in $(seq 1000); do
|
2023-07-05 07:17:52 +00:00
|
|
|
if [ $SECONDS -ge "$TIMELIMIT" ]; then
|
|
|
|
return
|
|
|
|
fi
|
2022-11-14 20:53:29 +00:00
|
|
|
$CLICKHOUSE_CLIENT -q "alter table src detach partition tuple()"
|
|
|
|
$CLICKHOUSE_CLIENT -q "alter table src attach partition tuple()"
|
|
|
|
$CLICKHOUSE_CLIENT -q "alter table src update A = ${i} where 1 settings mutations_sync=2"
|
|
|
|
$CLICKHOUSE_CLIENT -q "select throwIf(A != ${i}) from src format Null"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
TIMEOUT=30
|
|
|
|
|
2023-07-05 07:17:52 +00:00
|
|
|
thread $TIMEOUT || true
|