mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 21:51:57 +00:00
40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
import time
|
|
from helpers.test_tools import assert_eq_with_retry
|
|
|
|
|
|
def _parse_table_database(table, database):
|
|
if database is not None:
|
|
return table, database
|
|
|
|
if "." in table:
|
|
return reversed(table.split(".", 1))
|
|
|
|
return table, "default"
|
|
|
|
|
|
def wait_for_delete_inactive_parts(node, table, database=None, **kwargs):
|
|
table, database = _parse_table_database(table, database)
|
|
inactive_parts_query = (
|
|
f"SELECT count() FROM system.parts "
|
|
f"WHERE not active AND table = '{table}' AND database = '{database}';"
|
|
)
|
|
assert_eq_with_retry(node, inactive_parts_query, "0\n", **kwargs)
|
|
|
|
|
|
def wait_for_delete_empty_parts(node, table, database=None, **kwargs):
|
|
table, database = _parse_table_database(table, database)
|
|
empty_parts_query = (
|
|
f"SELECT count() FROM system.parts "
|
|
f"WHERE active AND rows = 0 AND table = '{table}' AND database = '{database}'"
|
|
)
|
|
assert_eq_with_retry(node, empty_parts_query, "0\n", **kwargs)
|
|
|
|
|
|
def wait_for_merges(node, table, database=None, **kwargs):
|
|
table, database = _parse_table_database(table, database)
|
|
merges_count_query = (
|
|
f"SELECT count() > 0 FROM system.merges "
|
|
f"WHERE table = '{table}' AND database = '{database}'"
|
|
)
|
|
assert_eq_with_retry(node, merges_count_query, "1\n", **kwargs)
|