Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions replica_side_filtering_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ class TestAllowFiltering(ReplicaSideFiltering):
def create_index(self):
return False

def _test_missed_update_with_transient_replicas(self, missed_by_transient):
def _test_missed_update_with_witness_replicas(self, missed_by_witness):
cluster = self.cluster
cluster.set_configuration_options(values={'hinted_handoff_enabled': False,
'num_tokens': 1,
Expand All @@ -541,18 +541,18 @@ def _test_missed_update_with_transient_replicas(self, missed_by_transient):
self.session.execute("INSERT INTO t(k, v) VALUES (0, 'old')")

# update the previous value with CL=ONE only in one replica
node = cluster.nodelist()[1 if missed_by_transient else 0]
node = cluster.nodelist()[1 if missed_by_witness else 0]
node.byteman_submit([mk_bman_path('stop_writes.btm')])
self.session.execute(SimpleStatement("UPDATE t SET v = 'new' WHERE k = 0", consistency_level=CL.ONE))

# query with CL=ALL to verify that no old values are resurrected
self._assert_none("SELECT * FROM t WHERE v = 'old'")
self._assert_one("SELECT * FROM t WHERE v = 'new'", row=[0, 'new'])

@since('4.0')
def test_update_missed_by_transient_replica(self):
self._test_missed_update_with_transient_replicas(missed_by_transient=True)
@since('5.1')
def test_update_missed_by_witness_replica(self):
self._test_missed_update_with_witness_replicas(missed_by_witness=True)

@since('4.0')
def test_update_only_on_transient_replica(self):
self._test_missed_update_with_transient_replicas(missed_by_transient=False)
@since('5.1')
def test_update_only_on_witness_replica(self):
self._test_missed_update_with_witness_replicas(missed_by_witness=False)
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def new_start(self, *args, **kwargs):
startable.start = types.MethodType(new_start, startable)


@since('4.0')
class TestTransientReplicationRing(Tester):
@since('5.1')
class TestWitnessReplicationRing(Tester):

keyspace = "ks"
table = "tbl"
Expand Down Expand Up @@ -177,8 +177,8 @@ def test_bootstrap_and_cleanup(self):

self.check_expected(sessions, expected)

# Ensure that there is at least some transient data around, because of this if it's missing after bootstrap
# We know we failed to get it from the transient replica losing the range entirely
# Ensure that there is at least some witness data around, because of this if it's missing after bootstrap
# We know we failed to get it from the witness replica losing the range entirely
nodes[1].stop(wait_other_notice=True)

for i in range(1, 40, 2):
Expand All @@ -193,7 +193,7 @@ def test_bootstrap_and_cleanup(self):
gen_expected(range(0, 21, 2), range(32, 40, 2)),
gen_expected(range(1, 11, 2), range(11, 31), range(31, 40, 2))]

# Every node should have some of its fully replicated data and one and two should have some transient data
# Every node should have some of its fully replicated data and one and two should have some witness data
self.check_expected(sessions, expected)

node4 = new_node(self.cluster, bootstrap=True, token='00040')
Expand All @@ -204,20 +204,20 @@ def test_bootstrap_and_cleanup(self):
expected.append(gen_expected(range(11, 20, 2), range(21, 40)))
sessions.append(self.exclusive_cql_connection(node4))

# Because repair was never run and nodes had transient data it will have data for transient ranges (node1, 11-20)
# Because repair was never run and nodes had witness data it will have data for witness ranges (node1, 11-20)
assert_all(sessions[3],
self.select(),
expected[3],
cl=NODELOCAL)

# Node1 no longer transiently replicates 11-20, so cleanup will clean it up
# Node1 also now transiently replicates 21-30 and half the values in that range were repaired
# Node1 no longer witness replicates 11-20, so cleanup will clean it up
# Node1 also now witness replicates 21-30 and half the values in that range were repaired
expected[0] = gen_expected(range(0, 11), range(21, 30, 2), range(31, 40))
# Node2 still missing data since it was down during some insertions, it also lost some range (31-40)
expected[1] = gen_expected(range(0, 21, 2))
expected[2] = gen_expected(range(1, 11, 2), range(11, 31))

# Cleanup should only impact if a node lost a range entirely or started to transiently replicate it and the data
# Cleanup should only impact if a node lost a range entirely or started to witness it and the data
# was repaired
self.check_expected(sessions, expected, nodes, cleanup=True)

Expand Down Expand Up @@ -249,8 +249,8 @@ def move_test(self, move_token, expected_after_move, expected_after_repair):
# Make sure at least a little data is repaired
repair_nodes(nodes)

# Ensure that there is at least some transient data around, because of this if it's missing after bootstrap
# We know we failed to get it from the transient replica losing the range entirely
# Ensure that there is at least some witness data around, because of this if it's missing after bootstrap
# We know we failed to get it from the witness replica losing the range entirely
nodes[1].stop(wait_other_notice=True)

for i in range(1, 40, 2):
Expand Down Expand Up @@ -357,8 +357,8 @@ def test_decommission(self):
# Make sure at least a little data is repaired
repair_nodes(nodes)

# Ensure that there is at least some transient data around, because of this if it's missing after bootstrap
# We know we failed to get it from the transient replica losing the range entirely
# Ensure that there is at least some witness data around, because of this if it's missing after bootstrap
# We know we failed to get it from the witness replica losing the range entirely
nodes[1].stop(wait_other_notice=True)

for i in range(1, 40, 2):
Expand All @@ -375,7 +375,7 @@ def test_decommission(self):

self.check_expected(sessions, expected)

# node1 has transient data we want to see streamed out on move
# node1 has witness data we want to see streamed out on move
nodes[3].nodetool('decommission')

nodes = nodes[:-1]
Expand All @@ -392,7 +392,7 @@ def test_decommission(self):

repair_nodes(nodes)

# There should be no transient data anywhere
# There should be no witness data anywhere
expected = [gen_expected(range(0, 11), range(21, 40)),
gen_expected(range(0, 21), range(31, 40)),
gen_expected(range(11, 31))]
Expand All @@ -402,7 +402,7 @@ def test_decommission(self):

@pytest.mark.no_vnodes
def test_remove(self):
"""Test a mix of ring change operations across a mix of transient and repaired/unrepaired data"""
"""Test a mix of ring change operations across a mix of witness and repaired/unrepaired data"""
node4 = new_node(self.cluster, bootstrap=True, token='00040')
patch_start(node4)
node4.start(wait_for_binary_proto=True)
Expand All @@ -423,7 +423,7 @@ def test_remove(self):
gen_expected(range(0, 21), range(31, 40)),
gen_expected(range(11, 31))]

# Every node should some of its fully replicated data and one and two should have some transient data
# Every node should some of its fully replicated data and one and two should have some witness data
self.check_expected(sessions, expected)

nodes[0].nodetool('removenode ' + node4_id)
Expand Down
Loading