mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Add test.
This commit is contained in:
parent
5154c1b9d0
commit
7b9d6c4b96
@ -276,6 +276,37 @@ def test_table_with_parts_in_queue_considered_non_empty():
|
||||
)
|
||||
|
||||
|
||||
def test_replicated_table_with_uuid_in_zkpath():
|
||||
node1.query(
|
||||
"CREATE TABLE tbl ON CLUSTER 'cluster' ("
|
||||
"x UInt8, y String"
|
||||
") ENGINE=ReplicatedMergeTree('/clickhouse/tables/{uuid}','{replica}')"
|
||||
"ORDER BY x"
|
||||
)
|
||||
|
||||
node1.query("INSERT INTO tbl VALUES (1, 'AA')")
|
||||
node2.query("INSERT INTO tbl VALUES (2, 'BB')")
|
||||
|
||||
backup_name = new_backup_name()
|
||||
node1.query(f"BACKUP TABLE tbl ON CLUSTER 'cluster' TO {backup_name}")
|
||||
|
||||
# The table `tbl2` is expected to have a different UUID so it's ok to have both `tbl` and `tbl2` at the same time.
|
||||
node2.query(f"RESTORE TABLE tbl AS tbl2 ON CLUSTER 'cluster' FROM {backup_name}")
|
||||
|
||||
node1.query("INSERT INTO tbl2 VALUES (3, 'CC')")
|
||||
|
||||
node1.query("SYSTEM SYNC REPLICA ON CLUSTER 'cluster' tbl")
|
||||
node1.query("SYSTEM SYNC REPLICA ON CLUSTER 'cluster' tbl2")
|
||||
|
||||
for instance in [node1, node2]:
|
||||
assert instance.query("SELECT * FROM tbl ORDER BY x") == TSV(
|
||||
[[1, "AA"], [2, "BB"]]
|
||||
)
|
||||
assert instance.query("SELECT * FROM tbl2 ORDER BY x") == TSV(
|
||||
[[1, "AA"], [2, "BB"], [3, "CC"]]
|
||||
)
|
||||
|
||||
|
||||
def test_replicated_table_with_not_synced_insert():
|
||||
node1.query(
|
||||
"CREATE TABLE tbl ON CLUSTER 'cluster' ("
|
||||
|
Loading…
Reference in New Issue
Block a user