From 387d68885e1bcb3330e4b6944a04f923ae59f0e0 Mon Sep 17 00:00:00 2001 From: Ruslan Fomkin Date: Fri, 11 Jun 2021 11:10:34 +0200 Subject: [PATCH] STAR-582 fix repair error on one node cluster (#20) Port of DB-1511, riptano/apollo-dtest#197 Co-authored-by: Zhao Yang (cherry picked from commit c7beefcbc97cd288badc48c483a3821dc694da58) (cherry picked from commit a02abc60c8f4a8fe70e6268a8103c62124d421c5) --- repair_tests/repair_test.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/repair_tests/repair_test.py b/repair_tests/repair_test.py index ddae777343..4ff6d024ea 100644 --- a/repair_tests/repair_test.py +++ b/repair_tests/repair_test.py @@ -1195,6 +1195,40 @@ def run_repair(): else: node1.nodetool('repair keyspace1 standard1 -inc -par') + @since('3.0') + def test_repair_one_node_cluster(self): + options = [] + fix_STAR582 = self.cluster.version() >= "4.0" + if not fix_STAR582: + options = ['--ignore-unreplicated-keyspaces'] + options + self._repair_abort_test(options=options, nodes=1, rf=2) + + @since('3.0') + def test_repair_one_node_in_local_dc(self): + self._repair_abort_test(options=['--ignore-unreplicated-keyspaces', '--in-local-dc'], nodes=[1, 1], rf={'dc1': 1, 'dc2': 1}, no_common_range=True) + + def _repair_abort_test(self, options=[], nodes=1, rf=1, no_common_range=False): + cluster = self.cluster + logger.debug("Starting cluster..") + cluster.populate(nodes).start(wait_for_binary_proto=True) + + node1 = self.cluster.nodelist()[0] + session = self.patient_cql_connection(node1) + create_ks(session, 'ks', rf=rf) + + support_preview = self.cluster.version() >= "4.0" + if support_preview: + logger.debug("Preview repair") + out = node1.repair(["--preview"] + options) + if no_common_range: + assert "Nothing to repair for " in str(out), "Expect 'Nothing to repair for '" + + logger.debug("Full repair") + node1.repair(["--full"] + options) + + logger.debug("Incremental repair") + node1.repair(options) + @since('2.2') def test_dead_sync_initiator(self): """