Skip to content

Commit 8a13330

Browse files
committed
fix(manager): get rf dynamically for repair test with multiDC cluster
In previous implementation the test was trying to set rf=2 per each DC while one of DCs had only one node. As a result, the test failed with error (1) like "Datacenter us-west-2scylla_node_west doesn't have enough token-owning nodes for replication_factor=2" The new approach will dynamically define the number of nodes per DC and set this value to DC's replication factor. refs: 1. https://jenkins.scylladb.com/job/manager-3.5/job/ubuntu22-sanity-test/1/
1 parent c9ffb67 commit 8a13330

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

mgmt_cli_test.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,22 @@ def get_all_dcs_names(self):
312312
dcs_names.add(data_center)
313313
return dcs_names
314314

315+
def get_rf_based_on_nodes_number(self) -> dict[str, int]:
316+
"""Define replication factor based on a number of nodes per DC(s).
317+
318+
Note: replication factor per DC will be equal to the number of nodes in that DC.
319+
Adjust the method if you need a custom value to be put there.
320+
321+
Example of return value:
322+
{
323+
"eu-west-2scylla_node_west": 2,
324+
"us-eastscylla_node_east": 1
325+
}
326+
"""
327+
nodetool_status = self.db_cluster.get_nodetool_status(self.db_cluster.nodes[0])
328+
rf = {dc_name: len(nodes) for dc_name, nodes in nodetool_status.items()}
329+
return rf
330+
315331

316332
class BucketOperations(ClusterTester):
317333
backup_azure_blob_service = None
@@ -1120,7 +1136,10 @@ def test_repair_multiple_keyspace_types(self): # pylint: disable=invalid-name
11201136
self.log.info('starting test_repair_multiple_keyspace_types')
11211137
manager_tool = mgmt.get_scylla_manager_tool(manager_node=self.monitors.nodes[0])
11221138
mgr_cluster = self.ensure_and_get_cluster(manager_tool)
1123-
self.create_keyspace_and_basic_table(self.NETWORKSTRATEGY_KEYSPACE_NAME, replication_factor=2)
1139+
1140+
rf = self.get_rf_based_on_nodes_number() if len(self.params.region_names) > 1 else 2
1141+
self.create_keyspace_and_basic_table(self.NETWORKSTRATEGY_KEYSPACE_NAME, replication_factor=rf)
1142+
11241143
self.create_keyspace_and_basic_table(self.LOCALSTRATEGY_KEYSPACE_NAME, replication_factor=0)
11251144
repair_task = mgr_cluster.create_repair_task()
11261145
task_final_status = repair_task.wait_and_get_final_status(timeout=7200)

0 commit comments

Comments
 (0)