Skip to content
Permalink
Browse files
Add new bootstrap test for race condition
Patch by Ekaterina Dimitrova, reviewed by brandonwilliams for CASSANDRA-14878
  • Loading branch information
ekaterinadimitrova2 authored and driftx committed Jan 13, 2020
1 parent a83ede4 commit fc5576e2804bc7cecd80058b6880d2fbeb026245
Showing 3 changed files with 43 additions and 3 deletions.
@@ -239,6 +239,32 @@ def test_read_from_bootstrapped_node(self):
new_rows = list(session.execute("SELECT * FROM %s" % (stress_table,)))
assert original_rows == new_rows

@since('3.0')
def test_bootstrap_waits_for_streaming_to_finish(self):
"""
Test that bootstrap completes and is marked as such after streaming finishes.
"""

cluster = self.cluster

logger.debug("Create a cluster")
cluster.populate(1)
node1 = cluster.nodelist()[0]

logger.debug("Start node 1")
node1.start(wait_for_binary_proto=True, wait_other_notice=True)

logger.debug("Insert 10k rows")
node1.stress(['write', 'n=10K', 'no-warmup', '-rate', 'threads=8', '-schema', 'replication(factor=2)'])

logger.debug("Bootstrap node 2 with delay")
node2 = new_node(cluster, byteman_port='4200')
node2.update_startup_byteman_script('./byteman/bootstrap_5s_sleep.btm')
node2.start(wait_for_binary_proto=True, wait_other_notice=True)

assert_bootstrap_state(self, node2, 'COMPLETED')
assert node2.grep_log('Bootstrap completed', filename='debug.log')

def test_consistent_range_movement_true_with_replica_down_should_fail(self):
self._bootstrap_test_with_replica_down(True)

@@ -800,4 +826,4 @@ def test_bootstrap_binary_disabled(self):
node3.nodetool('join')
self.assert_log_had_msg(node3, "Leaving write survey mode and joining ring at operator request", timeout=30)
assert_bootstrap_state(self, node3, 'COMPLETED', user='cassandra', password='cassandra')
node3.wait_for_binary_interface(timeout=30)
node3.wait_for_binary_interface(timeout=30)
@@ -0,0 +1,13 @@
#
# Sleep 5s when finishing bootstrap
#
RULE Sleep 5s when finishing bootstrap
CLASS org.apache.cassandra.service.StorageService
METHOD bootstrapFinished
AT ENTRY
# set flag to only run this rule once.
IF NOT flagged("done")
DO
flag("done");
Thread.sleep(5000)
ENDRULE
@@ -14,7 +14,7 @@


# work for cluster started by populate
def new_node(cluster, bootstrap=True, token=None, remote_debug_port='0', data_center=None):
def new_node(cluster, bootstrap=True, token=None, remote_debug_port='0', data_center=None, byteman_port='0'):
i = len(cluster.nodes) + 1
node = Node('node%s' % i,
cluster,
@@ -24,7 +24,8 @@ def new_node(cluster, bootstrap=True, token=None, remote_debug_port='0', data_ce
str(7000 + i * 100),
remote_debug_port,
token,
binary_interface=('127.0.0.%s' % i, 9042))
binary_interface=('127.0.0.%s' % i, 9042),
byteman_port=byteman_port)
cluster.add(node, not bootstrap, data_center=data_center)
return node

0 comments on commit fc5576e

Please sign in to comment.