You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jm...@apache.org on 2022/10/28 18:48:20 UTC

[cassandra-dtest] branch trunk updated: Add env var to resume bootstrap after disabling

This is an automated email from the ASF dual-hosted git repository.

jmckenzie pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git


The following commit(s) were added to refs/heads/trunk by this push:
     new c4711d34 Add env var to resume bootstrap after disabling
c4711d34 is described below

commit c4711d34097c785e70c5d46e3be0ef5051ac6a3d
Author: Josh McKenzie <jm...@apache.org>
AuthorDate: Mon Sep 26 14:23:07 2022 -0400

    Add env var to resume bootstrap after disabling
    
    Patch by Josh McKenzie; reviewed by Marcus Eriksson for CASSANDRA-17679
---
 bootstrap_test.py         | 25 +++++++++++++++++--------
 rebuild_test.py           |  7 +++----
 replace_address_test.py   |  3 ++-
 secondary_indexes_test.py |  5 +++--
 4 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/bootstrap_test.py b/bootstrap_test.py
index 51da884e..52dc2dfc 100644
--- a/bootstrap_test.py
+++ b/bootstrap_test.py
@@ -14,8 +14,6 @@ from ccmlib.node import NodeError, TimeoutError, ToolError, Node
 
 import pytest
 
-from distutils.version import LooseVersion
-
 from dtest import Tester, create_ks, create_cf, data_size, mk_bman_path
 from tools.assertions import (assert_almost_equal, assert_bootstrap_state, assert_not_running,
                               assert_one, assert_stderr_clean)
@@ -436,13 +434,13 @@ class BootstrapTester(Tester):
 
         # start bootstrapping node3 and wait for streaming
         node3 = new_node(cluster)
-        node3.start(wait_other_notice=False)
+        node3.start(jvm_args=['-Dcassandra.reset_bootstrap_progress=false'], wait_other_notice=False)
 
         # let streaming fail as we expect
         node3.watch_log_for('Some data streaming failed')
 
         # bring back node3 and invoke nodetool bootstrap to resume bootstrapping
-        node3.nodetool('bootstrap resume')
+        node3.nodetool(BootstrapTester.nodetool_resume_command(cluster))
         node3.wait_for_binary_interface()
         assert_bootstrap_state(self, node3, 'COMPLETED')
 
@@ -976,7 +974,7 @@ class BootstrapTester(Tester):
         node2.set_configuration_options(values=config)
         node2.byteman_port = '8101' # set for when we add node3
         node2.import_config_files()
-        node2.start(jvm_args=["-Dcassandra.ring_delay_ms=5000"])
+        node2.start(jvm_args=["-Dcassandra.ring_delay_ms=5000", "-Dcassandra.reset_bootstrap_progress=false"])
         self.assert_log_had_msg(node2, 'Some data streaming failed')
 
         try:
@@ -985,7 +983,7 @@ class BootstrapTester(Tester):
         except ToolError as t:
             assert "Cannot join the ring until bootstrap completes" in t.stdout
 
-        node2.nodetool('bootstrap resume')
+        node2.nodetool(BootstrapTester.nodetool_resume_command(cluster))
         node2.wait_for_binary_interface()
         assert_bootstrap_state(self, node2, 'COMPLETED', user='cassandra', password='cassandra')
 
@@ -1000,7 +998,7 @@ class BootstrapTester(Tester):
         else:
             node1.byteman_submit([self.byteman_submit_path_4_0])
             node2.byteman_submit([self.byteman_submit_path_4_0])
-        node3.start(jvm_args=["-Dcassandra.write_survey=true", "-Dcassandra.ring_delay_ms=5000"])
+        node3.start(jvm_args=["-Dcassandra.write_survey=true", "-Dcassandra.ring_delay_ms=5000", "-Dcassandra.reset_bootstrap_progress=false"])
         self.assert_log_had_msg(node3, 'Some data streaming failed')
         self.assert_log_had_msg(node3, "Not starting client transports in write_survey mode as it's bootstrapping or auth is enabled")
 
@@ -1010,7 +1008,7 @@ class BootstrapTester(Tester):
         except ToolError as t:
             assert "Cannot join the ring until bootstrap completes" in t.stdout
 
-        node3.nodetool('bootstrap resume')
+        node3.nodetool(BootstrapTester.nodetool_resume_command(cluster))
         self.assert_log_had_msg(node3, "Not starting client transports in write_survey mode as it's bootstrapping or auth is enabled")
 
         # Should succeed in joining
@@ -1019,6 +1017,17 @@ class BootstrapTester(Tester):
         assert_bootstrap_state(self, node3, 'COMPLETED', user='cassandra', password='cassandra')
         node3.wait_for_binary_interface()
 
+    @staticmethod
+    def nodetool_resume_command(cluster):
+        """
+        In versions after 4.1, we disable resumable bootstrap by default (see CASSANDRA-17679). In order to run
+        nodetool boostrap resume in these subsequent versions we have to manually indicate the intent to allow resumability.
+        """
+        nt_resume_cmd = 'bootstrap resume'
+        if cluster.version() >= '4.2':
+            nt_resume_cmd += ' -f'
+        return nt_resume_cmd
+
 
 class TestBootstrap(BootstrapTester):
     """
diff --git a/rebuild_test.py b/rebuild_test.py
index 36732966..6f3a4455 100644
--- a/rebuild_test.py
+++ b/rebuild_test.py
@@ -176,8 +176,8 @@ class TestRebuild(Tester):
         cluster.add(node1, True, data_center='dc1')
         cluster.add(node2, True, data_center='dc1')
 
-        node1.start(wait_for_binary_proto=True)
-        node2.start(wait_for_binary_proto=True)
+        node1.start(wait_for_binary_proto=True, jvm_args=['-Dcassandra.reset_bootstrap_progress=false'])
+        node2.start(wait_for_binary_proto=True, jvm_args=['-Dcassandra.reset_bootstrap_progress=false'])
 
         # Insert data into node1 and node2
         session = self.patient_exclusive_cql_connection(node1)
@@ -200,8 +200,7 @@ class TestRebuild(Tester):
 
         cluster.add(node3, False, data_center='dc2')
 
-        node3.start(wait_other_notice=False, wait_for_binary_proto=True)
-
+        node3.start(wait_other_notice=False, wait_for_binary_proto=True, jvm_args=['-Dcassandra.reset_bootstrap_progress=false'])
         # Wait for snitch to be refreshed
         time.sleep(5)
 
diff --git a/replace_address_test.py b/replace_address_test.py
index 441d474d..799f42c4 100644
--- a/replace_address_test.py
+++ b/replace_address_test.py
@@ -13,6 +13,7 @@ from cassandra import ConsistencyLevel, ReadTimeout, Unavailable
 from cassandra.query import SimpleStatement
 from ccmlib.node import Node
 
+from bootstrap_test import BootstrapTester
 from dtest import Tester, mk_bman_path
 from tools.assertions import assert_bootstrap_state, assert_all, assert_not_running
 from tools.data import rows_to_list
@@ -534,7 +535,7 @@ class TestReplaceAddress(BaseReplaceAddressTest):
             self.replacement_node.watch_log_for("Resetting bootstrap progress to start fresh", from_mark=mark)
         elif mode == 'resume':
             logger.debug("Resuming failed bootstrap")
-            self.replacement_node.nodetool('bootstrap resume')
+            self.replacement_node.nodetool(BootstrapTester.nodetool_resume_command(self.cluster))
             # check if we skipped already retrieved ranges
             self.replacement_node.watch_log_for("already available. Skipping streaming.")
             self.replacement_node.watch_log_for("Resume complete")
diff --git a/secondary_indexes_test.py b/secondary_indexes_test.py
index c0ddc390..a9b0b10a 100644
--- a/secondary_indexes_test.py
+++ b/secondary_indexes_test.py
@@ -14,6 +14,7 @@ from cassandra.concurrent import (execute_concurrent,
 from cassandra.protocol import ConfigurationException
 from cassandra.query import BatchStatement, SimpleStatement
 
+from bootstrap_test import BootstrapTester
 from dtest import Tester, create_ks, create_cf, mk_bman_path
 from tools.assertions import assert_bootstrap_state, assert_invalid, assert_none, assert_one, assert_row_count, \
     assert_length_equal, assert_all
@@ -1224,10 +1225,10 @@ class TestPreJoinCallback(Tester):
                 yaml_opts['streaming_socket_timeout_in_ms'] = 1000
 
             node2.set_configuration_options(values=yaml_opts)
-            node2.start(wait_for_binary_proto=False)
+            node2.start(wait_for_binary_proto=False, jvm_args=["-Dcassandra.reset_bootstrap_progress=false"])
             node2.watch_log_for('Some data streaming failed. Use nodetool to check bootstrap state and resume.')
 
-            node2.nodetool("bootstrap resume")
+            node2.nodetool(BootstrapTester.nodetool_resume_command(cluster))
             node2.watch_log_for('Starting listening for CQL clients')
             assert_bootstrap_state(self, node2, 'COMPLETED')
             assert node2.grep_log('Executing pre-join post-bootstrap tasks')


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org