def failed_bootstap_wiped_node_can_join_test(self): """ @jira_ticket CASSANDRA-9765 Test that if a node fails to bootstrap, it can join the cluster even if the data is wiped. """ cluster = self.cluster cluster.populate(1) cluster.start(wait_for_binary_proto=True) version = cluster.version() stress_table = 'keyspace1.standard1' if self.cluster.version() >= '2.1' else '"Keyspace1"."Standard1"' # write some data, enough for the bootstrap to fail later on node1 = cluster.nodelist()[0] if version < "2.1": node1.stress(['-n', '100000']) else: node1.stress(['write', 'n=100000', '-rate', 'threads=8']) node1.flush() session = self.patient_cql_connection(node1) original_rows = list(session.execute("SELECT * FROM {}".format(stress_table,))) # Add a new node, bootstrap=True ensures that it is not a seed node2 = new_node(cluster, bootstrap=True) node2.set_configuration_options(values={'stream_throughput_outbound_megabits_per_sec': 1}) # kill node2 in the middle of bootstrap t = KillOnBootstrap(node2) t.start() node2.start() t.join() self.assertFalse(node2.is_running()) # wipe any data for node2 data_dir = os.path.join(node2.get_path(), 'data') commitlog_dir = os.path.join(node2.get_path(), 'commitlogs') debug("Deleting {}".format(data_dir)) shutil.rmtree(data_dir) shutil.rmtree(commitlog_dir) # Now start it again, it should be allowed to join mark = node2.mark_log() node2.start(wait_other_notice=True) node2.watch_log_for("JOINING:", from_mark=mark)
def failed_bootstrap_wiped_node_can_join_test(self): """ @jira_ticket CASSANDRA-9765 Test that if a node fails to bootstrap, it can join the cluster even if the data is wiped. """ cluster = self.cluster cluster.populate(1) cluster.set_configuration_options(values={'stream_throughput_outbound_megabits_per_sec': 1}) cluster.start(wait_for_binary_proto=True) stress_table = 'keyspace1.standard1' # write some data, enough for the bootstrap to fail later on node1 = cluster.nodelist()[0] node1.stress(['write', 'n=100K', 'no-warmup', '-rate', 'threads=8']) node1.flush() session = self.patient_cql_connection(node1) original_rows = list(session.execute("SELECT * FROM {}".format(stress_table,))) # Add a new node, bootstrap=True ensures that it is not a seed node2 = new_node(cluster, bootstrap=True) # kill node2 in the middle of bootstrap t = KillOnBootstrap(node2) t.start() node2.start() t.join() self.assertFalse(node2.is_running()) # wipe any data for node2 self._cleanup(node2) # Now start it again, it should be allowed to join mark = node2.mark_log() node2.start(wait_other_notice=True) node2.watch_log_for("JOINING:", from_mark=mark)
def failed_bootstap_wiped_node_can_join_test(self): """ @jira_ticket CASSANDRA-9765 Test that if a node fails to bootstrap, it can join the cluster even if the data is wiped. """ cluster = self.cluster cluster.populate(1) cluster.start(wait_for_binary_proto=True) version = cluster.version() stress_table = 'keyspace1.standard1' if self.cluster.version( ) >= '2.1' else '"Keyspace1"."Standard1"' # write some data, enough for the bootstrap to fail later on node1 = cluster.nodelist()[0] if version < "2.1": node1.stress(['-n', '100000']) else: node1.stress(['write', 'n=100000', '-rate', 'threads=8']) node1.flush() session = self.patient_cql_connection(node1) original_rows = list( session.execute("SELECT * FROM {}".format(stress_table, ))) # Add a new node, bootstrap=True ensures that it is not a seed node2 = new_node(cluster, bootstrap=True) node2.set_configuration_options( values={'stream_throughput_outbound_megabits_per_sec': 1}) # kill node2 in the middle of bootstrap t = KillOnBootstrap(node2) t.start() node2.start() t.join() self.assertFalse(node2.is_running()) # wipe any data for node2 data_dir = os.path.join(node2.get_path(), 'data') commitlog_dir = os.path.join(node2.get_path(), 'commitlogs') debug("Deleting {}".format(data_dir)) shutil.rmtree(data_dir) shutil.rmtree(commitlog_dir) # Now start it again, it should be allowed to join mark = node2.mark_log() node2.start(wait_other_notice=True) node2.watch_log_for("JOINING:", from_mark=mark)
def failed_bootstrap_wiped_node_can_join_test(self): """ @jira_ticket CASSANDRA-9765 Test that if a node fails to bootstrap, it can join the cluster even if the data is wiped. """ cluster = self.cluster cluster.populate(1) cluster.set_configuration_options( values={'stream_throughput_outbound_megabits_per_sec': 1}) cluster.start(wait_for_binary_proto=True) stress_table = 'keyspace1.standard1' # write some data, enough for the bootstrap to fail later on node1 = cluster.nodelist()[0] node1.stress(['write', 'n=100K', 'no-warmup', '-rate', 'threads=8']) node1.flush() session = self.patient_cql_connection(node1) original_rows = list( session.execute("SELECT * FROM {}".format(stress_table, ))) # Add a new node, bootstrap=True ensures that it is not a seed node2 = new_node(cluster, bootstrap=True) # kill node2 in the middle of bootstrap t = KillOnBootstrap(node2) t.start() node2.start() t.join() self.assertFalse(node2.is_running()) # wipe any data for node2 self._cleanup(node2) # Now start it again, it should be allowed to join mark = node2.mark_log() node2.start(wait_other_notice=True) node2.watch_log_for("JOINING:", from_mark=mark)