mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-02 20:42:04 +00:00
better test
This commit is contained in:
parent
5f33aaf59b
commit
242d6d0cb8
143
tests/queries/0_stateless/02555_davengers_rename_chain.sh
Executable file
143
tests/queries/0_stateless/02555_davengers_rename_chain.sh
Executable file
@ -0,0 +1,143 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tags: replica
|
||||
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CUR_DIR"/../shell_config.sh
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS wrong_metadata"
|
||||
|
||||
$CLICKHOUSE_CLIENT -n --query="CREATE TABLE wrong_metadata(
|
||||
a UInt64,
|
||||
b UInt64,
|
||||
c UInt64
|
||||
)
|
||||
ENGINE ReplicatedMergeTree('/test/{database}/tables/wrong_metadata', '1')
|
||||
ORDER BY tuple()
|
||||
SETTINGS min_bytes_for_wide_part = 0"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="INSERT INTO wrong_metadata VALUES (1, 2, 3)"
|
||||
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SYSTEM STOP MERGES wrong_metadata"
|
||||
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="ALTER TABLE wrong_metadata RENAME COLUMN a TO a1, RENAME COLUMN b to b1 SETTINGS replication_alter_partitions_sync = 0"
|
||||
|
||||
counter=0 retries=60
|
||||
I=0
|
||||
while [[ $counter -lt $retries ]]; do
|
||||
I=$((I + 1))
|
||||
result=$($CLICKHOUSE_CLIENT --query "show create table wrong_metadata")
|
||||
if [[ $result == *"a1 UInt64"* ]]; then
|
||||
break;
|
||||
fi
|
||||
sleep 0.1
|
||||
((++counter))
|
||||
done
|
||||
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SELECT * FROM wrong_metadata ORDER BY a1 FORMAT JSONEachRow"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SELECT '~~~~~~~'"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="INSERT INTO wrong_metadata VALUES (4, 5, 6)"
|
||||
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SELECT * FROM wrong_metadata ORDER BY a1 FORMAT JSONEachRow"
|
||||
$CLICKHOUSE_CLIENT --query="SELECT '~~~~~~~'"
|
||||
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="ALTER TABLE wrong_metadata RENAME COLUMN a1 TO b, RENAME COLUMN b1 to a SETTINGS replication_alter_partitions_sync = 0"
|
||||
|
||||
counter=0 retries=60
|
||||
I=0
|
||||
while [[ $counter -lt $retries ]]; do
|
||||
I=$((I + 1))
|
||||
result=$($CLICKHOUSE_CLIENT --query "show create table wrong_metadata")
|
||||
if [[ $result == *"b UInt64"* ]]; then
|
||||
break;
|
||||
fi
|
||||
sleep 0.1
|
||||
((++counter))
|
||||
done
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="INSERT INTO wrong_metadata VALUES (7, 8, 9)"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SELECT * FROM wrong_metadata ORDER by a1 FORMAT JSONEachRow"
|
||||
$CLICKHOUSE_CLIENT --query="SELECT '~~~~~~~'"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SYSTEM START MERGES wrong_metadata"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SYSTEM SYNC REPLICA wrong_metadata"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SELECT * FROM wrong_metadata order by a FORMAT JSONEachRow"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SELECT '~~~~~~~'"
|
||||
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS wrong_metadata"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS wrong_metadata_compact"
|
||||
|
||||
$CLICKHOUSE_CLIENT -n --query="CREATE TABLE wrong_metadata_compact(
|
||||
a UInt64,
|
||||
b UInt64,
|
||||
c UInt64
|
||||
)
|
||||
ENGINE ReplicatedMergeTree('/test/{database}/tables/wrong_metadata_compact', '1')
|
||||
ORDER BY tuple()
|
||||
SETTINGS min_bytes_for_wide_part = 10000000"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="INSERT INTO wrong_metadata_compact VALUES (1, 2, 3)"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SYSTEM STOP MERGES wrong_metadata_compact"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="ALTER TABLE wrong_metadata_compact RENAME COLUMN a TO a1, RENAME COLUMN b to b1 SETTINGS replication_alter_partitions_sync = 0"
|
||||
|
||||
counter=0 retries=60
|
||||
I=0
|
||||
while [[ $counter -lt $retries ]]; do
|
||||
I=$((I + 1))
|
||||
result=$($CLICKHOUSE_CLIENT --query "show create table wrong_metadata_compact")
|
||||
if [[ $result == *"b1 UInt64"* ]]; then
|
||||
break;
|
||||
fi
|
||||
sleep 0.1
|
||||
((++counter))
|
||||
done
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SELECT * FROM wrong_metadata_compact ORDER BY a1 FORMAT JSONEachRow"
|
||||
$CLICKHOUSE_CLIENT --query="SELECT '~~~~~~~'"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="INSERT INTO wrong_metadata_compact VALUES (4, 5, 6)"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SELECT * FROM wrong_metadata_compact ORDER BY a1 FORMAT JSONEachRow"
|
||||
$CLICKHOUSE_CLIENT --query="SELECT '~~~~~~~'"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="ALTER TABLE wrong_metadata_compact RENAME COLUMN a1 TO b, RENAME COLUMN b1 to a SETTINGS replication_alter_partitions_sync = 0"
|
||||
|
||||
counter=0 retries=60
|
||||
I=0
|
||||
while [[ $counter -lt $retries ]]; do
|
||||
I=$((I + 1))
|
||||
result=$($CLICKHOUSE_CLIENT --query "show create table wrong_metadata_compact")
|
||||
if [[ $result == *"b UInt64"* ]]; then
|
||||
break;
|
||||
fi
|
||||
sleep 0.1
|
||||
((++counter))
|
||||
done
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="INSERT INTO wrong_metadata_compact VALUES (7, 8, 9)"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SELECT * FROM wrong_metadata_compact ORDER by a1 FORMAT JSONEachRow"
|
||||
$CLICKHOUSE_CLIENT --query="SELECT '~~~~~~~'"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SYSTEM START MERGES wrong_metadata_compact"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SYSTEM SYNC REPLICA wrong_metadata_compact"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SELECT * FROM wrong_metadata_compact order by a FORMAT JSONEachRow"
|
||||
$CLICKHOUSE_CLIENT --query="SELECT '~~~~~~~'"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS wrong_metadata_compact"
|
@ -1,91 +0,0 @@
|
||||
DROP TABLE IF EXISTS wrong_metadata;
|
||||
|
||||
CREATE TABLE wrong_metadata(
|
||||
a UInt64,
|
||||
b UInt64,
|
||||
c UInt64
|
||||
)
|
||||
ENGINE ReplicatedMergeTree('/test/{database}/tables/wrong_metadata', '1')
|
||||
ORDER BY tuple()
|
||||
SETTINGS min_bytes_for_wide_part = 0;
|
||||
|
||||
INSERT INTO wrong_metadata VALUES (1, 2, 3);
|
||||
|
||||
SYSTEM STOP MERGES wrong_metadata;
|
||||
|
||||
ALTER TABLE wrong_metadata RENAME COLUMN a TO a1, RENAME COLUMN b to b1 SETTINGS replication_alter_partitions_sync = 0;
|
||||
|
||||
SELECT sleep(1) FORMAT Null;
|
||||
|
||||
SELECT * FROM wrong_metadata ORDER BY a1 FORMAT JSONEachRow;
|
||||
SELECT '~~~~~~~';
|
||||
|
||||
INSERT INTO wrong_metadata VALUES (4, 5, 6);
|
||||
|
||||
SELECT * FROM wrong_metadata ORDER BY a1 FORMAT JSONEachRow;
|
||||
SELECT '~~~~~~~';
|
||||
|
||||
ALTER TABLE wrong_metadata RENAME COLUMN a1 TO b, RENAME COLUMN b1 to a SETTINGS replication_alter_partitions_sync = 0;
|
||||
|
||||
SELECT sleep(1) FORMAT Null;
|
||||
SELECT sleep(1) FORMAT Null;
|
||||
|
||||
INSERT INTO wrong_metadata VALUES (7, 8, 9);
|
||||
|
||||
SELECT * FROM wrong_metadata ORDER by a1 FORMAT JSONEachRow;
|
||||
SELECT '~~~~~~~';
|
||||
|
||||
SYSTEM START MERGES wrong_metadata;
|
||||
|
||||
SYSTEM SYNC REPLICA wrong_metadata;
|
||||
|
||||
SELECT * FROM wrong_metadata order by a FORMAT JSONEachRow;
|
||||
SELECT '~~~~~~~';
|
||||
|
||||
DROP TABLE IF EXISTS wrong_metadata;
|
||||
|
||||
DROP TABLE IF EXISTS wrong_metadata_compact;
|
||||
|
||||
CREATE TABLE wrong_metadata_compact(
|
||||
a UInt64,
|
||||
b UInt64,
|
||||
c UInt64
|
||||
)
|
||||
ENGINE ReplicatedMergeTree('/test/{database}/tables/wrong_metadata_compact', '1')
|
||||
ORDER BY tuple()
|
||||
SETTINGS min_bytes_for_wide_part = 10000000;
|
||||
|
||||
INSERT INTO wrong_metadata_compact VALUES (1, 2, 3);
|
||||
|
||||
SYSTEM STOP MERGES wrong_metadata_compact;
|
||||
|
||||
ALTER TABLE wrong_metadata_compact RENAME COLUMN a TO a1, RENAME COLUMN b to b1 SETTINGS replication_alter_partitions_sync = 0;
|
||||
|
||||
SELECT sleep(1) FORMAT Null;
|
||||
|
||||
SELECT * FROM wrong_metadata_compact ORDER BY a1 FORMAT JSONEachRow;
|
||||
SELECT '~~~~~~~';
|
||||
|
||||
INSERT INTO wrong_metadata_compact VALUES (4, 5, 6);
|
||||
|
||||
SELECT * FROM wrong_metadata_compact ORDER BY a1 FORMAT JSONEachRow;
|
||||
SELECT '~~~~~~~';
|
||||
|
||||
ALTER TABLE wrong_metadata_compact RENAME COLUMN a1 TO b, RENAME COLUMN b1 to a SETTINGS replication_alter_partitions_sync = 0;
|
||||
|
||||
SELECT sleep(1) FORMAT Null;
|
||||
SELECT sleep(1) FORMAT Null;
|
||||
|
||||
INSERT INTO wrong_metadata_compact VALUES (7, 8, 9);
|
||||
|
||||
SELECT * FROM wrong_metadata_compact ORDER by a1 FORMAT JSONEachRow;
|
||||
SELECT '~~~~~~~';
|
||||
|
||||
SYSTEM START MERGES wrong_metadata_compact;
|
||||
|
||||
SYSTEM SYNC REPLICA wrong_metadata_compact;
|
||||
|
||||
SELECT * FROM wrong_metadata_compact order by a FORMAT JSONEachRow;
|
||||
SELECT '~~~~~~~';
|
||||
|
||||
DROP TABLE IF EXISTS wrong_metadata_compact;
|
Loading…
Reference in New Issue
Block a user