mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 01:22:04 +00:00
fix test
This commit is contained in:
parent
db8079768a
commit
997f2742d7
@ -47,9 +47,8 @@ snapshotting_node = cluster.add_instance(
|
||||
snapshot_recovering_node = cluster.add_instance(
|
||||
"snapshot_recovering_node",
|
||||
main_configs=["configs/config.xml"],
|
||||
user_configs=["configs/inconsistent_settings.xml"],
|
||||
user_configs=["configs/settings.xml"],
|
||||
with_zookeeper=True,
|
||||
macros={"shard": 1, "replica": 4},
|
||||
)
|
||||
|
||||
all_nodes = [
|
||||
@ -60,6 +59,14 @@ all_nodes = [
|
||||
snapshot_recovering_node,
|
||||
]
|
||||
|
||||
bad_settings_node = cluster.add_instance(
|
||||
"snapshot_recovering_node",
|
||||
main_configs=["configs/config.xml"],
|
||||
user_configs=["configs/inconsistent_settings.xml"],
|
||||
with_zookeeper=True,
|
||||
macros={"shard": 1, "replica": 4},
|
||||
)
|
||||
|
||||
uuid_regex = re.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")
|
||||
|
||||
|
||||
@ -1448,12 +1455,12 @@ def test_table_metadata_corruption(started_cluster):
|
||||
|
||||
def test_auto_recovery(started_cluster):
|
||||
dummy_node.query("DROP DATABASE IF EXISTS auto_recovery")
|
||||
snapshot_recovering_node.query("DROP DATABASE IF EXISTS auto_recovery")
|
||||
bad_settings_node.query("DROP DATABASE IF EXISTS auto_recovery")
|
||||
|
||||
dummy_node.query(
|
||||
"CREATE DATABASE auto_recovery ENGINE = Replicated('/clickhouse/databases/auto_recovery', 'shard1', 'replica1');"
|
||||
)
|
||||
snapshot_recovering_node.query(
|
||||
bad_settings_node.query(
|
||||
"CREATE DATABASE auto_recovery ENGINE = Replicated('/clickhouse/databases/auto_recovery', 'shard1', 'replica2') SETTINGS max_retries_before_automatic_recovery=3;"
|
||||
)
|
||||
|
||||
@ -1463,7 +1470,7 @@ def test_auto_recovery(started_cluster):
|
||||
dummy_node.query("INSERT INTO auto_recovery.t1 SELECT 42")
|
||||
# dummy_node has <throw_on_unsupported_query_inside_transaction>0</throw_on_unsupported_query_inside_transaction> (default is 1),
|
||||
# so it will consider that the setting is changed, and will write it to the DDL entry
|
||||
# snapshot_recovering_node has implicit_transaction=1, so it will fail and recover from snapshot
|
||||
# bad_settings_node has implicit_transaction=1, so it will fail and recover from snapshot
|
||||
dummy_node.query(
|
||||
"CREATE TABLE auto_recovery.t2 (n int) ENGINE=ReplicatedMergeTree ORDER BY tuple()",
|
||||
settings={
|
||||
@ -1477,20 +1484,18 @@ def test_auto_recovery(started_cluster):
|
||||
settings={"distributed_ddl_task_timeout": 0},
|
||||
)
|
||||
|
||||
snapshot_recovering_node.query(
|
||||
bad_settings_node.query(
|
||||
"SYSTEM SYNC DATABASE REPLICA auto_recovery", settings={"receive_timeout": 60}
|
||||
)
|
||||
assert snapshot_recovering_node.contains_in_log(
|
||||
assert bad_settings_node.contains_in_log(
|
||||
"Unexpected error (3 times in a row), will try to restart main thread"
|
||||
)
|
||||
assert snapshot_recovering_node.contains_in_log(
|
||||
"Cannot begin an implicit transaction"
|
||||
)
|
||||
snapshot_recovering_node.query("SYSTEM SYNC REPLICA auto_recovery.t1")
|
||||
snapshot_recovering_node.query("SYSTEM SYNC REPLICA auto_recovery.t2")
|
||||
assert bad_settings_node.contains_in_log("Cannot begin an implicit transaction")
|
||||
bad_settings_node.query("SYSTEM SYNC REPLICA auto_recovery.t1")
|
||||
bad_settings_node.query("SYSTEM SYNC REPLICA auto_recovery.t2")
|
||||
|
||||
assert "42\n" == dummy_node.query("SELECT * FROM auto_recovery.t2")
|
||||
assert "137\n" == dummy_node.query("SELECT * FROM auto_recovery.t1")
|
||||
|
||||
assert "42\n" == snapshot_recovering_node.query("SELECT * FROM auto_recovery.t2")
|
||||
assert "137\n" == snapshot_recovering_node.query("SELECT * FROM auto_recovery.t1")
|
||||
assert "42\n" == bad_settings_node.query("SELECT * FROM auto_recovery.t2")
|
||||
assert "137\n" == bad_settings_node.query("SELECT * FROM auto_recovery.t1")
|
||||
|
Loading…
Reference in New Issue
Block a user