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

smiklosovic 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 147c4135 CASSANDRA-21326 - avoid cms init on 6.0->later upgrades
147c4135 is described below

commit 147c41358eedaea6c4c2acd7f23f358e2ea19412
Author: Marcus Eriksson <[email protected]>
AuthorDate: Thu May 28 12:18:48 2026 +0200

    CASSANDRA-21326 - avoid cms init on 6.0->later upgrades
    
    patch by Marcus Eriksson; reviewed by Francisco Guerrero for CASSANDRA-21326
---
 dtest.py                                       |  9 +++++++++
 upgrade_tests/storage_engine_upgrade_test.py   | 10 ++++++----
 upgrade_tests/upgrade_through_versions_test.py |  4 ++--
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/dtest.py b/dtest.py
index 8170da48..b181037b 100644
--- a/dtest.py
+++ b/dtest.py
@@ -48,6 +48,7 @@ if len(config.read(os.path.expanduser('~/.cassandra-dtest'))) 
> 0:
 
 MAJOR_VERSION_4 = LooseVersion('4.0')
 MAJOR_VERSION_5 = LooseVersion('5.0')
+MAJOR_VERSION_6 = LooseVersion('6.0')
 
 logger = logging.getLogger(__name__)
 
@@ -557,3 +558,11 @@ def hack_legacy_parsing(node):
             fd.seek(0)
             fd.writelines(contents)
 
+def needs_cms_initialize(cluster):
+    node = cluster.nodelist()[0]
+    if node.get_cassandra_version() < MAJOR_VERSION_6:
+        return False
+
+    res = node.nodetool("cms").stdout
+    logger.debug(res)
+    return any(line.strip() == "Service State: GOSSIP" for line in 
res.splitlines())
diff --git a/upgrade_tests/storage_engine_upgrade_test.py 
b/upgrade_tests/storage_engine_upgrade_test.py
index 5992e7e7..10890d7a 100644
--- a/upgrade_tests/storage_engine_upgrade_test.py
+++ b/upgrade_tests/storage_engine_upgrade_test.py
@@ -3,7 +3,7 @@ import time
 import pytest
 import logging
 
-from dtest import Tester, MAJOR_VERSION_4, MAJOR_VERSION_5
+from dtest import Tester, MAJOR_VERSION_4, MAJOR_VERSION_5, MAJOR_VERSION_6, 
needs_cms_initialize
 from sstable_generation_loading_test import BaseSStableLoaderTester
 from thrift_bindings.thrift010.Cassandra import (ConsistencyLevel, Deletion,
                                            Mutation, SlicePredicate,
@@ -12,7 +12,7 @@ from thrift_test import composite, get_thrift_client, i32
 from tools.assertions import (assert_all, assert_length_equal, assert_none,
                               assert_one)
 from tools.misc import new_node
-from upgrade_tests.upgrade_manifest import indev_2_2_x, indev_3_0_x, 
indev_4_0_x
+from upgrade_tests.upgrade_manifest import indev_2_2_x, indev_3_0_x, 
indev_4_0_x, indev_5_0_x
 
 since = pytest.mark.since
 logger = logging.getLogger(__name__)
@@ -39,7 +39,9 @@ class TestStorageEngineUpgrade(Tester):
             cluster.set_configuration_options(cluster_options)
 
         # Forcing cluster version on purpose
-        if self.dtest_config.cassandra_version_from_build >= MAJOR_VERSION_5:
+        if self.dtest_config.cassandra_version_from_build >= MAJOR_VERSION_6:
+            cluster.set_install_dir(version=indev_5_0_x.version)
+        elif self.dtest_config.cassandra_version_from_build >= MAJOR_VERSION_5:
             cluster.set_install_dir(version=indev_4_0_x.version)
         elif self.dtest_config.cassandra_version_from_build >= MAJOR_VERSION_4:
             cluster.set_install_dir(version=indev_3_0_x.version)
@@ -69,7 +71,7 @@ class TestStorageEngineUpgrade(Tester):
         
node1.set_install_dir(install_dir=self.fixture_dtest_setup.default_install_dir)
         self.install_legacy_parsing(node1)
         node1.start(wait_for_binary_proto=True)
-        if node1.get_cassandra_version() >= '5.1':
+        if needs_cms_initialize(cluster):
             node1.nodetool("cms initialize")
         if self.fixture_dtest_setup.bootstrap:
             
cluster.set_install_dir(install_dir=self.fixture_dtest_setup.default_install_dir)
diff --git a/upgrade_tests/upgrade_through_versions_test.py 
b/upgrade_tests/upgrade_through_versions_test.py
index 2471ed93..b1354315 100644
--- a/upgrade_tests/upgrade_through_versions_test.py
+++ b/upgrade_tests/upgrade_through_versions_test.py
@@ -18,7 +18,7 @@ from queue import Empty, Full
 from cassandra import ConsistencyLevel, WriteTimeout, DriverException, 
OperationTimedOut
 from cassandra.query import SimpleStatement
 
-from dtest import Tester
+from dtest import Tester, needs_cms_initialize
 from tools.misc import generate_ssl_stores, new_node
 from .upgrade_manifest import (build_upgrade_pairs, jdk_compatible_steps, 
current_2_2_x,
                                current_3_0_x, current_3_11_x,
@@ -499,7 +499,7 @@ class TestUpgrade(Tester):
                 self._check_counters()
                 self._check_select_count()
 
-        if self.cluster.version() >= '5.1':
+        if needs_cms_initialize(self.cluster):
             self.cluster.nodelist()[0].nodetool("cms initialize")
         # run custom post-upgrade callables
         for call in after_upgrade_call:


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

Reply via email to