diff options
author | Олег <150132506+iddqdex@users.noreply.github.com> | 2024-11-12 19:56:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-12 16:56:15 +0000 |
commit | df96fa4fe0f080778ccc813115dbf123556cce8e (patch) | |
tree | 8cb7249f16ef02179222c7045fb4be753e23d503 | |
parent | df88dacd50f5f93c372ec6ab803c69350c220aae (diff) | |
download | ydb-df96fa4fe0f080778ccc813115dbf123556cce8e.tar.gz |
Fix balancing checking (#11540)
-rw-r--r-- | ydb/tests/olap/lib/ydb_cluster.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/ydb/tests/olap/lib/ydb_cluster.py b/ydb/tests/olap/lib/ydb_cluster.py index ac7704979ab..36e566ed7e4 100644 --- a/ydb/tests/olap/lib/ydb_cluster.py +++ b/ydb/tests/olap/lib/ydb_cluster.py @@ -55,7 +55,7 @@ class YdbCluster: @classmethod def get_cluster_nodes(cls, path=None): try: - url = f'{cls._get_service_url()}/viewer/json/nodes?database={cls.ydb_database}' + url = f'{cls._get_service_url()}/viewer/json/nodes?database=/{cls.ydb_database}' if path is not None: url += f'&path={path}&tablets=true' headers = {} @@ -129,17 +129,16 @@ class YdbCluster: return cls._ydb_driver @classmethod - def _list_directory_impl(cls, root_path: str, rel_path: str) -> List[ydb.SchemeEntry]: - full_path = f'{root_path}/{rel_path}' - LOGGER.info(f'list {full_path}') + def _list_directory_impl(cls, path) -> List[ydb.SchemeEntry]: + LOGGER.info(f'list {path}') result = [] - for child in cls.get_ydb_driver().scheme_client.list_directory(full_path).children: + for child in cls.get_ydb_driver().scheme_client.list_directory(path).children: if child.name == '.sys': continue - child.name = f'{rel_path}/{child.name}' - if child.is_directory() or child.is_column_store(): - result += cls._list_directory_impl(root_path, child.name) + child.name = f'{path}/{child.name}' result.append(child) + if child.is_directory() or child.is_column_store(): + result += cls._list_directory_impl(child.name) return result @classmethod @@ -155,7 +154,7 @@ class YdbCluster: self_descr = cls._describe_path_impl(full_path) if self_descr is not None: if self_descr.is_directory(): - for descr in cls._list_directory_impl(full_path, '/'): + for descr in cls._list_directory_impl(full_path): if descr.is_any_table(): result.append(descr.name) elif self_descr.is_any_table(): @@ -246,10 +245,11 @@ class YdbCluster: errors.append(f'Node {tn.get("SystemState", {}).get("Host")}: {tablet.get("Count")} tablets of type {tablet.get("Type")} in {tablet.get("State")} state') if tablet.get("Type") in {"ColumnShard", "DataShard"}: tablet_count += tablet.get("Count") - if min is None or tablet_count < min: - min = tablet_count - if max is None or tablet_count > max: - max = tablet_count + if tablet_count > 0: + if min is None or tablet_count < min: + min = tablet_count + if max is None or tablet_count > max: + max = tablet_count if min is None or max is None: errors.append(f'Table {p} has no tablets') elif max - min > 1: |