Merge pull request #67747 from azat/tests/test_ttl_move

Fix test_ttl_move::test_alter_with_merge_work flakiness
This commit is contained in:
Nikita Fomichev 2024-08-04 16:47:24 +00:00 committed by GitHub
commit c4a0e7665c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -76,7 +76,7 @@ def get_used_disks_for_table(node, table_name, partition=None):
)
def check_used_disks_with_retry(node, table_name, expected_disks, retries):
def check_used_disks_with_retry(node, table_name, expected_disks, retries=1):
for _ in range(retries):
used_disks = get_used_disks_for_table(node, table_name)
if set(used_disks).issubset(expected_disks):
@ -1613,7 +1613,7 @@ def test_alter_with_merge_work(started_cluster, name, engine, positive):
ALTER TABLE {name} MODIFY
TTL d1 + INTERVAL 0 SECOND TO DISK 'jbod2',
d1 + INTERVAL 5 SECOND TO VOLUME 'external',
d1 + INTERVAL 10 SECOND DELETE
d1 + INTERVAL 30 SECOND DELETE
""".format(
name=name
)
@ -1635,11 +1635,19 @@ def test_alter_with_merge_work(started_cluster, name, engine, positive):
optimize_table(20)
if positive:
assert check_used_disks_with_retry(node1, name, set(["external"]), 100)
assert check_used_disks_with_retry(
node1, name, set(["external"])
), "Parts: " + node1.query(
f"SELECT disk_name, name FROM system.parts WHERE table = '{name}' AND active = 1"
)
else:
assert check_used_disks_with_retry(node1, name, set(["jbod1", "jbod2"]), 50)
assert check_used_disks_with_retry(
node1, name, set(["jbod1", "jbod2"])
), "Parts: " + node1.query(
f"SELECT disk_name, name FROM system.parts WHERE table = '{name}' AND active = 1"
)
time.sleep(5)
time.sleep(25)
optimize_table(20)