Merge pull request #37957 from ClickHouse/tavplubix-patch-1

Fix flaky `test_parts_delete_zookeeper`
This commit is contained in:
alesapin 2022-06-10 11:47:55 +02:00 committed by GitHub
commit 36924cb47d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,12 +79,16 @@ def test_merge_doesnt_work_without_zookeeper(start_cluster):
== "2\n"
)
# Parts may be moved to Deleting state and then back in Outdated state.
# But system.parts returns only Active and Outdated parts if _state column is not queried.
with PartitionManager() as pm:
node1.query("OPTIMIZE TABLE test_table FINAL")
pm.drop_instance_zk_connections(node1)
# unfortunately we can be too fast and delete node before partition with ZK
if (
node1.query("SELECT count(*) from system.parts where table = 'test_table'")
node1.query(
"SELECT count(*) from system.parts where table = 'test_table' and _state!='dummy'"
)
== "1\n"
):
print("We were too fast and deleted parts before partition with ZK")
@ -92,7 +96,7 @@ def test_merge_doesnt_work_without_zookeeper(start_cluster):
time.sleep(10) # > old_parts_lifetime
assert (
node1.query(
"SELECT count(*) from system.parts where table = 'test_table'"
"SELECT count(*) from system.parts where table = 'test_table' and _state!='dummy'"
)
== "3\n"
)