Skip to content

Commit

Permalink
STAR-582 fix repair error on one node cluster (#20)
Browse files Browse the repository at this point in the history
Port of DB-1511, riptano/apollo-dtest#197

Co-authored-by: Zhao Yang <[email protected]>
(cherry picked from commit c7beefc)
(cherry picked from commit a02abc6)
  • Loading branch information
k-rus authored and jacek-lewandowski committed Jun 25, 2021
1 parent ba91f9d commit 387d688
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions repair_tests/repair_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down

0 comments on commit 387d688

Please sign in to comment.