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

brandonwilliams 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 598b44c9 Add legacy parsing for nodetool when lacking CASSANDRA-17581
598b44c9 is described below

commit 598b44c9392c92e1fbfa183d5570bbb7206f3d35
Author: Brandon Williams <[email protected]>
AuthorDate: Tue Sep 13 10:25:19 2022 -0500

    Add legacy parsing for nodetool when lacking CASSANDRA-17581
    
    Patch by brandonwilliams; reviewed by edimitrova for CASSANDRA-17885
---
 counter_test.py                                    |  2 ++
 dtest_setup.py                                     | 13 +++++++++++++
 legacy_sstables_test.py                            |  1 +
 offline_tools_test.py                              |  2 ++
 replace_address_test.py                            |  2 ++
 secondary_indexes_test.py                          |  1 +
 sstable_generation_loading_test.py                 |  2 ++
 upgrade_crc_check_chance_test.py                   |  1 +
 upgrade_internal_auth_test.py                      |  3 +++
 upgrade_tests/drop_compact_storage_upgrade_test.py |  1 +
 upgrade_tests/repair_test.py                       |  1 +
 upgrade_tests/storage_engine_upgrade_test.py       |  1 +
 upgrade_tests/thrift_upgrade_test.py               |  6 +++++-
 upgrade_tests/upgrade_base.py                      |  1 +
 14 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/counter_test.py b/counter_test.py
index 103db9e4..00fc1df0 100644
--- a/counter_test.py
+++ b/counter_test.py
@@ -32,6 +32,7 @@ class TestCounters(Tester):
         #
 
         cluster.set_install_dir(version='2.0.17')
+        self.install_nodetool_legacy_parsing()
         cluster.populate(3)
         cluster.start()
 
@@ -61,6 +62,7 @@ class TestCounters(Tester):
         #
 
         cluster.set_install_dir(version='2.1.17')
+        self.install_nodetool_legacy_parsing()
         cluster.start()
         cluster.nodetool("upgradesstables")
 
diff --git a/dtest_setup.py b/dtest_setup.py
index 50509e66..3d37c9d6 100644
--- a/dtest_setup.py
+++ b/dtest_setup.py
@@ -84,6 +84,19 @@ class DTestSetup(object):
         self.create_cluster_func = None
         self.iterations = 0
 
+    def install_nodetool_legacy_parsing(self):
+        """ Hack nodetool on old versions for legacy URL parsing, ala 
CASSANDRA-17581 """
+        if self.cluster.version() < LooseVersion('3.0'):
+            logger.debug("hacking nodetool for legacy parsing")
+            nodetool = os.path.join(self.cluster.get_install_dir(), 'bin', 
'nodetool')
+            with open(nodetool, 'r+') as fd:
+                contents = fd.readlines()
+                contents.insert(len(contents)-5, "      
-Dcom.sun.jndi.rmiURLParsing=legacy \\\n")
+                fd.seek(0)
+                fd.writelines(contents)
+        else:
+            logger.debug("not modifying nodetool on version 
{}".format(self.cluster.version()))
+
     def set_ignore_log_patterns(self, other):
         if self._ignore_log_patterns == None:
             self._ignore_log_patterns = default_ignore_log_patterns()
diff --git a/legacy_sstables_test.py b/legacy_sstables_test.py
index c8c400e1..c09e4dbf 100644
--- a/legacy_sstables_test.py
+++ b/legacy_sstables_test.py
@@ -27,6 +27,7 @@ class TestLegacySSTables(Tester):
 
         # start with 2.1.20 to generate a legacy sstable
         cluster.set_install_dir(version='2.1.20')
+        self.install_nodetool_legacy_parsing()
 
         cluster.populate(1).start()
         node1 = cluster.nodelist()[0]
diff --git a/offline_tools_test.py b/offline_tools_test.py
index 54c0e067..1c3d81bc 100644
--- a/offline_tools_test.py
+++ b/offline_tools_test.py
@@ -362,10 +362,12 @@ class TestOfflineTools(Tester):
         elif testversion < '3.0':
             logger.debug('Test version: {} - installing 
github:apache/cassandra-2.1'.format(testversion))
             cluster.set_install_dir(version='github:apache/cassandra-2.1')
+            self.install_nodetool_legacy_parsing()
         # As of 3.5, sstable format 'ma' from 3.0 is still the latest - 
install 2.2 to upgrade from
         elif testversion < '4.0':
             logger.debug('Test version: {} - installing 
github:apache/cassandra-2.2'.format(testversion))
             cluster.set_install_dir(version='github:apache/cassandra-2.2')
+            self.install_nodetool_legacy_parsing()
         # From 4.0, one can only upgrade from 3.0
         else:
             logger.debug('Test version: {} - installing 
github:apache/cassandra-3.0'.format(testversion))
diff --git a/replace_address_test.py b/replace_address_test.py
index bab39103..441d474d 100644
--- a/replace_address_test.py
+++ b/replace_address_test.py
@@ -62,6 +62,8 @@ class BaseReplaceAddressTest(Tester):
         if mixed_versions:
             logger.debug("Starting nodes on version 2.2.4")
             self.cluster.set_install_dir(version="2.2.4")
+            self.install_nodetool_legacy_parsing()
+
 
         self.cluster.start()
 
diff --git a/secondary_indexes_test.py b/secondary_indexes_test.py
index 16cf447b..c0ddc390 100644
--- a/secondary_indexes_test.py
+++ b/secondary_indexes_test.py
@@ -1101,6 +1101,7 @@ class TestUpgradeSecondaryIndexes(Tester):
 
         # Forcing cluster version on purpose
         cluster.set_install_dir(version="2.0.12")
+        self.install_nodetool_legacy_parsing()
         if "memtable_allocation_type" in cluster._config_options:
             cluster._config_options.__delitem__("memtable_allocation_type")
         cluster.populate(1).start()
diff --git a/sstable_generation_loading_test.py 
b/sstable_generation_loading_test.py
index 434e8ff4..5c309b2c 100644
--- a/sstable_generation_loading_test.py
+++ b/sstable_generation_loading_test.py
@@ -174,6 +174,7 @@ class BaseSStableLoaderTester(Tester):
             default_install_dir = self.cluster.get_install_dir()
             # Forcing cluster version on purpose
             cluster.set_install_dir(version=self.upgrade_from)
+            self.install_nodetool_legacy_parsing()
             
self.fixture_dtest_setup.reinitialize_cluster_for_different_version()
         logger.debug("Using jvm_args={}".format(self.jvm_args))
         cluster.populate(2).start(jvm_args=list(self.jvm_args))
@@ -215,6 +216,7 @@ class BaseSStableLoaderTester(Tester):
             logger.debug("Running sstableloader with version from %s" % 
(default_install_dir))
             # Return to previous version
             cluster.set_install_dir(install_dir=default_install_dir)
+            self.install_nodetool_legacy_parsing()
             
self.fixture_dtest_setup.reinitialize_cluster_for_different_version()
 
         cluster.start(jvm_args=list(self.jvm_args))
diff --git a/upgrade_crc_check_chance_test.py b/upgrade_crc_check_chance_test.py
index 74b75843..88f590a7 100644
--- a/upgrade_crc_check_chance_test.py
+++ b/upgrade_crc_check_chance_test.py
@@ -32,6 +32,7 @@ class TestCrcCheckChanceUpgrade(Tester):
 
         # Forcing cluster version on purpose
         cluster.set_install_dir(version="github:apache/cassandra-2.2")
+        self.install_nodetool_legacy_parsing()
         cluster.populate(2).start()
 
         node1, node2 = cluster.nodelist()
diff --git a/upgrade_internal_auth_test.py b/upgrade_internal_auth_test.py
index ffc4cab5..64b580f1 100644
--- a/upgrade_internal_auth_test.py
+++ b/upgrade_internal_auth_test.py
@@ -58,6 +58,8 @@ class TestAuthUpgrade(Tester):
 
         # Forcing cluster version on purpose
         cluster.set_install_dir(version="2.1.16")
+        self.install_nodetool_legacy_parsing()
+
         cluster.populate(3).start()
 
         node1, node2, node3 = cluster.nodelist()
@@ -119,6 +121,7 @@ class TestAuthUpgrade(Tester):
 
         # Forcing cluster version on purpose
         cluster.set_install_dir(version="github:apache/cassandra-2.1")
+        self.install_nodetool_legacy_parsing()
         cluster.populate(3).start()
 
         node1, node2, node3 = cluster.nodelist()
diff --git a/upgrade_tests/drop_compact_storage_upgrade_test.py 
b/upgrade_tests/drop_compact_storage_upgrade_test.py
index 86b4ffda..45cbeed0 100644
--- a/upgrade_tests/drop_compact_storage_upgrade_test.py
+++ b/upgrade_tests/drop_compact_storage_upgrade_test.py
@@ -24,6 +24,7 @@ class TestDropCompactStorage(Tester):
 
         # Forcing cluster version on purpose
         cluster.set_install_dir(version="2.1.14")
+        self.install_nodetool_legacy_parsing()
         cluster.start(wait_for_binary_proto=True)
 
         session = self.patient_exclusive_cql_connection(node1)
diff --git a/upgrade_tests/repair_test.py b/upgrade_tests/repair_test.py
index 93ec6dd8..c1fc1b0a 100644
--- a/upgrade_tests/repair_test.py
+++ b/upgrade_tests/repair_test.py
@@ -27,6 +27,7 @@ class TestUpgradeRepair(BaseRepairTest):
         cluster = self.cluster
         logger.debug("Setting version to 2.2.5")
         cluster.set_install_dir(version="2.2.5")
+        self.install_nodetool_legacy_parsing()
         self._populate_cluster()
 
         self._do_upgrade(default_install_dir)
diff --git a/upgrade_tests/storage_engine_upgrade_test.py 
b/upgrade_tests/storage_engine_upgrade_test.py
index 2a4fe0c6..ebedcb9a 100644
--- a/upgrade_tests/storage_engine_upgrade_test.py
+++ b/upgrade_tests/storage_engine_upgrade_test.py
@@ -43,6 +43,7 @@ class TestStorageEngineUpgrade(Tester):
             cluster.set_install_dir(version=indev_3_0_x.version)
         else:
             cluster.set_install_dir(version=indev_2_1_x.version)
+            self.install_nodetool_legacy_parsing()
         self.fixture_dtest_setup.reinitialize_cluster_for_different_version()
         cluster.populate(1).start()
 
diff --git a/upgrade_tests/thrift_upgrade_test.py 
b/upgrade_tests/thrift_upgrade_test.py
index 6de1c819..1b29862c 100644
--- a/upgrade_tests/thrift_upgrade_test.py
+++ b/upgrade_tests/thrift_upgrade_test.py
@@ -207,6 +207,7 @@ class TestUpgradeSuperColumnsThrough(Tester):
             node.set_configuration_options(values={'start_rpc': 'true', 
'enable_drop_compact_storage': 'true'})
             logger.debug("Set new cassandra dir for %s: %s" % (node.name, 
node.get_install_dir()))
         self.cluster.set_install_dir(version=tag)
+        self.install_nodetool_legacy_parsing()
         self.fixture_dtest_setup.reinitialize_cluster_for_different_version()
         for node in nodes:
             node.set_configuration_options(values={'start_rpc': 'true', 
'enable_drop_compact_storage': 'true'})
@@ -224,6 +225,7 @@ class TestUpgradeSuperColumnsThrough(Tester):
 
         # Forcing cluster version on purpose
         cluster.set_install_dir(version=cassandra_version)
+        self.install_nodetool_legacy_parsing()
         self.fixture_dtest_setup.reinitialize_cluster_for_different_version()
 
         cluster.populate(num_nodes)
@@ -397,6 +399,7 @@ class TestUpgradeTo40(Tester):
             connection to the first node in the cluster.
         """
         self.cluster.set_install_dir(version=start_version)
+        self.install_nodetool_legacy_parsing()
         self.fixture_dtest_setup.reinitialize_cluster_for_different_version()
 
         self.cluster.populate(num_nodes)
@@ -736,4 +739,5 @@ for spec in specs:
     cls = type(gen_class_name, (TestThrift,), spec)
     if not upgrade_applies_to_env:
         add_skip(cls, 'test not applicable to env.')
-    globals()[gen_class_name] = cls
\ No newline at end of file
+    globals()[gen_class_name] = cls
+
diff --git a/upgrade_tests/upgrade_base.py b/upgrade_tests/upgrade_base.py
index 24ef8af6..f23fe982 100644
--- a/upgrade_tests/upgrade_base.py
+++ b/upgrade_tests/upgrade_base.py
@@ -106,6 +106,7 @@ class UpgradeTester(Tester, metaclass=ABCMeta):
         cluster = self.cluster
 
         cluster.set_install_dir(version=self.UPGRADE_PATH.starting_version)
+        self.install_nodetool_legacy_parsing()
         self.fixture_dtest_setup.reinitialize_cluster_for_different_version()
 
         if ordered:


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to