From e57d75b34bf11b4603a4c29a7c26eb6d304de196 Mon Sep 17 00:00:00 2001 From: yarongilor Date: Sun, 15 Sep 2024 10:50:49 +0300 Subject: [PATCH] fix(_get_keyspaces_to_decrease_rf): Address a case where no keyspace RF value of DC In case no keyspace replication-factor value is retrieved in a DC, A warning is logged and the keyspace is ignored (skipped). Fixes: #8694 --- sdcm/utils/replication_strategy_utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sdcm/utils/replication_strategy_utils.py b/sdcm/utils/replication_strategy_utils.py index f398568501..a463e69045 100644 --- a/sdcm/utils/replication_strategy_utils.py +++ b/sdcm/utils/replication_strategy_utils.py @@ -180,8 +180,12 @@ def _get_keyspaces_to_decrease_rf(self, session) -> list: continue # Skip keyspace using SimpleStrategy if 'NetworkTopologyStrategy' in replication['class']: - rf = int(replication.get(self.datacenter)) - if rf == self.original_nodes_number: + rf = replication.get(self.datacenter) + if rf is None: + LOGGER.warning( + f"Datacenter {self.datacenter} not found in replication strategy for keyspace {keyspace_name}.") + continue + if int(rf) == self.original_nodes_number: matching_keyspaces.append(keyspace_name) else: LOGGER.warning("Unexpected replication strategy found: %s", replication['class'])