diff --git a/test_runner/performance/test_storage_controller_scale.py b/test_runner/performance/test_storage_controller_scale.py index 40da23b5ac..ef72755a56 100644 --- a/test_runner/performance/test_storage_controller_scale.py +++ b/test_runner/performance/test_storage_controller_scale.py @@ -12,6 +12,7 @@ from fixtures.neon_fixtures import ( ) from fixtures.pageserver.http import PageserverHttpClient from fixtures.pg_version import PgVersion +from typing import Dict def get_consistent_node_shard_counts(env: NeonEnv, total_shards): tenants = env.storage_controller.tenant_list() @@ -19,6 +20,8 @@ def get_consistent_node_shard_counts(env: NeonEnv, total_shards): intent = dict() observed = dict() + tenant_placement: defaultdict[str, Dict] = defaultdict(lambda: {"observed": {"attached": None, "secondary": []}, "intent": {"attached": None, "secondary": []}}) + for t in tenants: for node_id, loc_state in t["observed"]["locations"].items(): if ( @@ -28,9 +31,24 @@ def get_consistent_node_shard_counts(env: NeonEnv, total_shards): and loc_state["conf"]["mode"] in set(["AttachedSingle", "AttachedMulti", "AttachedStale"]) ): observed[t["tenant_shard_id"]] = int(node_id) + tenant_placement[t["tenant_shard_id"]]["observed"]["attached"] = int(node_id) + + if ( + loc_state is not None + and "conf" in loc_state + and loc_state["conf"] is not None + and loc_state["conf"]["mode"] == "Secondary" + ): + tenant_placement[t["tenant_shard_id"]]["observed"]["secondary"].append(int(node_id)) if "attached" in t["intent"]: intent[t["tenant_shard_id"]] = t["intent"]["attached"] + tenant_placement[t["tenant_shard_id"]]["intent"]["attached"] = t["intent"]["attached"] + + if "secondary" in t["intent"]: + tenant_placement[t["tenant_shard_id"]]["intent"]["secondary"] += t["intent"]["secondary"] + + log.info(f"{tenant_placement=}") matching = {tid: intent[tid] for tid in observed if tid in intent and intent[tid] == observed[tid]} assert len(matching) == total_shards