Add broken test

This commit is contained in:
alesapin 2023-03-02 12:28:26 +01:00
parent 46f25d53b3
commit 95c51d2997
2 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,70 @@
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS table_to_rename"
$CLICKHOUSE_CLIENT --query="CREATE TABLE table_to_rename(v UInt64, v1 UInt64)ENGINE = MergeTree ORDER BY tuple() SETTINGS min_bytes_for_wide_part = 0"
$CLICKHOUSE_CLIENT --query="INSERT INTO table_to_rename VALUES (1, 1)"
# we want to following mutations to stuck
# That is why we stop merges and wait in loops until they actually start
$CLICKHOUSE_CLIENT --query="SYSTEM STOP MERGES table_to_rename"
$CLICKHOUSE_CLIENT --query="ALTER TABLE table_to_rename UPDATE v1 = 77 WHERE 1 = 1 SETTINGS mutations_sync = 2" &
counter=0 retries=60
I=0
while [[ $counter -lt $retries ]]; do
I=$((I + 1))
result=$($CLICKHOUSE_CLIENT --query "SELECT count() from system.mutations where database='${CLICKHOUSE_DATABASE}' and table='table_to_rename'")
if [[ $result == "1" ]]; then
break;
fi
sleep 0.1
((++counter))
done
$CLICKHOUSE_CLIENT --query="ALTER TABLE table_to_rename RENAME COLUMN v1 to v2" &
counter=0 retries=60
I=0
while [[ $counter -lt $retries ]]; do
I=$((I + 1))
result=$($CLICKHOUSE_CLIENT --query "show create table table_to_rename")
if [[ $result == *"v2"* ]]; then
break;
fi
sleep 0.1
((++counter))
done
counter=0 retries=60
I=0
while [[ $counter -lt $retries ]]; do
I=$((I + 1))
result=$($CLICKHOUSE_CLIENT --query "SELECT count() from system.mutations where database='${CLICKHOUSE_DATABASE}' and table='table_to_rename'")
if [[ $result == "2" ]]; then
break;
fi
sleep 0.1
((++counter))
done
$CLICKHOUSE_CLIENT --query="SYSTEM START MERGES table_to_rename"
wait
$CLICKHOUSE_CLIENT --query="SELECT * FROM table_to_rename FORMAT JSONEachRow"
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS table_to_rename"