You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ed...@apache.org on 2021/03/11 02:49:55 UTC

[cassandra-dtest] branch trunk updated: Tests fixed and new ones added for CASSANDRA-15897

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

edimitrova 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 700f712  Tests fixed and new ones added for CASSANDRA-15897
700f712 is described below

commit 700f712c0ee87ea90c960e7fe92343bff7b2ba23
Author: Ekaterina Dimitrova <ek...@datastax.com>
AuthorDate: Fri Dec 11 10:06:19 2020 -0500

    Tests fixed and new ones added for CASSANDRA-15897
    
    patch by Ekaterina Dimitrova; reviewed by Benjamin Lerer and Brandon Williams
---
 snitch_test.py                                     |  16 +--
 upgrade_tests/drop_compact_storage_upgrade_test.py | 131 ++++++++++++++++++---
 2 files changed, 124 insertions(+), 23 deletions(-)

diff --git a/snitch_test.py b/snitch_test.py
index 5b640c8..a931303 100644
--- a/snitch_test.py
+++ b/snitch_test.py
@@ -127,26 +127,26 @@ class TestGossipingPropertyFileSnitch(Tester):
         logger.debug(out)
 
         assert "/{}".format(NODE1_BROADCAST_ADDRESS) in out
-        assert "INTERNAL_IP:{}:{}".format('9' if running40 else '6', NODE1_LISTEN_ADDRESS) in out
+        assert "INTERNAL_IP:{}:{}".format('10' if running40 else '7', NODE1_LISTEN_ADDRESS) in out
         assert "/{}".format(NODE2_BROADCAST_ADDRESS) in out
         if running40:
-            assert "INTERNAL_ADDRESS_AND_PORT:7:{}".format(NODE1_40_LISTEN_ADDRESS) in out
-            assert "INTERNAL_ADDRESS_AND_PORT:7:{}".format(NODE2_40_LISTEN_ADDRESS) in out
+            assert "INTERNAL_ADDRESS_AND_PORT:8:{}".format(NODE1_40_LISTEN_ADDRESS) in out
+            assert "INTERNAL_ADDRESS_AND_PORT:8:{}".format(NODE2_40_LISTEN_ADDRESS) in out
         else:
-            assert "INTERNAL_IP:{}:{}".format('6', NODE2_LISTEN_ADDRESS) in out
+            assert "INTERNAL_IP:{}:{}".format('7', NODE2_LISTEN_ADDRESS) in out
 
         out, err, _ = node2.nodetool('gossipinfo')
         assert_stderr_clean(err)
         logger.debug(out)
 
         assert "/{}".format(NODE1_BROADCAST_ADDRESS) in out
-        assert "INTERNAL_IP:{}:{}".format('9' if running40 else '6', NODE2_LISTEN_ADDRESS) in out
+        assert "INTERNAL_IP:{}:{}".format('10' if running40 else '7', NODE2_LISTEN_ADDRESS) in out
         assert "/{}".format(NODE2_BROADCAST_ADDRESS) in out
         if running40:
-            assert "INTERNAL_ADDRESS_AND_PORT:7:{}".format(NODE1_40_LISTEN_ADDRESS) in out
-            assert "INTERNAL_ADDRESS_AND_PORT:7:{}".format(NODE2_40_LISTEN_ADDRESS) in out
+            assert "INTERNAL_ADDRESS_AND_PORT:8:{}".format(NODE1_40_LISTEN_ADDRESS) in out
+            assert "INTERNAL_ADDRESS_AND_PORT:8:{}".format(NODE2_40_LISTEN_ADDRESS) in out
         else:
-            assert "INTERNAL_IP:{}:{}".format('6', NODE1_LISTEN_ADDRESS) in out
+            assert "INTERNAL_IP:{}:{}".format('7', NODE1_LISTEN_ADDRESS) in out
 
 class TestDynamicEndpointSnitch(Tester):
     @pytest.mark.resource_intensive
diff --git a/upgrade_tests/drop_compact_storage_upgrade_test.py b/upgrade_tests/drop_compact_storage_upgrade_test.py
index 695e82f..338eb26 100644
--- a/upgrade_tests/drop_compact_storage_upgrade_test.py
+++ b/upgrade_tests/drop_compact_storage_upgrade_test.py
@@ -1,3 +1,5 @@
+import time
+
 import pytest
 import logging
 
@@ -8,20 +10,18 @@ from dtest import Tester
 since = pytest.mark.since
 logger = logging.getLogger(__name__)
 
+VERSION_30 = 'github:apache/cassandra-3.0'
+VERSION_311 = 'github:apache/cassandra-3.11'
+VERSION_TRUNK = 'github:apache/trunk'
 
 @pytest.mark.upgrade_test
-@since('3.0', max_version='3.11')
 class TestDropCompactStorage(Tester):
-    def test_drop_compact_storage(self):
-        """
-        Test to verify that dropping compact storage is not possible prior running `nodetool upgradesstables`. The
-        current solution and test take care only about the local sstables. Global check of the sstables will be added as
-        part of CASSANDRA-15897.
-        @jira_ticket CASSANDRA-16063
-        """
+    def prepare(self):
         cluster = self.cluster
-        cluster.populate(2)
-        node1, node2 = cluster.nodelist()
+        cluster.populate(3)
+        node1, node2, node3 = cluster.nodelist()
+
+        # Forcing cluster version on purpose
         cluster.set_install_dir(version="2.1.14")
         cluster.start(wait_for_binary_proto=True)
 
@@ -35,6 +35,33 @@ class TestDropCompactStorage(Tester):
             session.execute(
                 "INSERT INTO drop_compact_storage_test.test (a, b, c) VALUES ('{}', '{}', '{}');".format(i, i + 1,
                                                                                                          i + 2))
+        return cluster
+
+    def drop_compact_storage(self, session, assert_msg):
+        try:
+            session.execute("ALTER TABLE drop_compact_storage_test.test DROP COMPACT STORAGE")
+            self.fail("No exception has been thrown")
+        except InvalidRequest as e:
+            assert assert_msg in str(e)
+
+    def upgrade_node(self, node, to_version):
+        node.drain()
+        node.watch_log_for("DRAINED")
+        node.stop(wait_other_notice=False)
+
+        node.set_install_dir(version=to_version)
+        node.start(wait_other_notice=False, wait_for_binary_proto=False, verbose=False)
+
+    @since('3.0', max_version='3.11')
+    def test_drop_compact_storage(self):
+        """
+        @jira_ticket CASSANDRA-15897
+
+        Test to verify that dropping compact storage is not possible prior running `nodetool upgradesstables` when we still
+        have old pre-3.0 SSTables in the cluster.
+        """
+        cluster = self.prepare()
+        node1, node2, node3 = cluster.nodelist()
 
         logging.debug("Upgrading to current version")
         for node in [node1, node2]:
@@ -46,13 +73,87 @@ class TestDropCompactStorage(Tester):
             node.start(wait_for_binary_proto=True)
 
         session = self.patient_exclusive_cql_connection(node1)
-        try:
-            session.execute("ALTER TABLE drop_compact_storage_test.test DROP COMPACT STORAGE")
-            self.fail("No exception has been thrown")
-        except InvalidRequest as e:
-            assert "Cannot DROP COMPACT STORAGE until all SSTables are upgraded, please run `nodetool upgradesstables` first." in str(e)
+        assert_msg = "Cannot DROP COMPACT STORAGE as some nodes in the cluster ([/127.0.0.3]) are not on 3.0+ yet. " \
+                     "Please upgrade those nodes and run `upgradesstables` before retrying."
+        self.drop_compact_storage(session, assert_msg)
+
+        self.upgrade_node(node3, VERSION_30)
+
+        # time provided to gossip to update its info after upgrade
+        time.sleep(5)
+
+        for node in [node1, node2, node3]:
+            node.nodetool("upgradesstables")
+
+        time.sleep(2)
+
+        session.execute("ALTER TABLE drop_compact_storage_test.test DROP COMPACT STORAGE")
+        session.execute("SELECT * FROM drop_compact_storage_test.test")
+
+    @since('4.0')
+    def test_drop_compact_storage_mixed_cluster(self):
+        """
+        @jira_ticket CASSANDRA-15897
+
+        Test to verify that dropping compact storage is not possible prior running `nodetool upgradesstables` when we still
+        have old pre-3.0 sstables in the cluster. Also, all nodes to be on the same major version.
+        """
+        cluster = self.prepare()
+        node1, node2, node3 = cluster.nodelist()
+
+        logging.debug("Upgrading all nodes to version 3.0")
+        for node in [node1, node2, node3]:
+            self.upgrade_node(node, VERSION_30)
+
+        session = self.patient_exclusive_cql_connection(node3)
+        assert_msg = "Cannot DROP COMPACT STORAGE as some nodes in the cluster ([/127.0.0.1, /127.0.0.2, /127.0.0.3]) has some " \
+                     "non-upgraded 2.x sstables. Please run `upgradesstables` on those nodes before retrying"
+        self.drop_compact_storage(session, assert_msg)
+
+        node3.nodetool("upgradesstables")
+        time.sleep(1)
+
+        assert_msg = "Cannot DROP COMPACT STORAGE as some nodes in the cluster ([/127.0.0.1, /127.0.0.2]) has some " \
+                     "non-upgraded 2.x sstables. Please run `upgradesstables` on those nodes before retrying"
+        self.drop_compact_storage(session, assert_msg)
+
+        self.upgrade_node(node3, VERSION_311)
+
+        time.sleep(5)
+
+        session = self.patient_exclusive_cql_connection(node3)
+        self.drop_compact_storage(session, assert_msg)
+
+        node2.nodetool("upgradesstables")
+
+        # time for gossip to update its info after running upgradesstables
+        time.sleep(2)
+
+        assert_msg = "Cannot DROP COMPACT STORAGE as some nodes in the cluster ([/127.0.0.1]) has some " \
+                     "non-upgraded 2.x sstables. Please run `upgradesstables` on those nodes before retrying"
+        self.drop_compact_storage(session, assert_msg)
+
+        self.upgrade_node(node2, VERSION_311)
+
+        self.upgrade_node(node3, VERSION_TRUNK)
+
+        node1.nodetool("upgradesstables")
+        time.sleep(2)
+
+        session = self.patient_exclusive_cql_connection(node3)
+        session.execute("SELECT * FROM drop_compact_storage_test.test")
+        assert_msg = "Cannot DROP COMPACT STORAGE as some nodes in the cluster ([/127.0.0.2:7000, /127.0.0.1:7000]) are not on 4.0+ yet. " \
+                     "Please upgrade those nodes and run `upgradesstables` before retrying."
+        self.drop_compact_storage(session, assert_msg)
 
         for node in [node1, node2]:
+            self.upgrade_node(node, VERSION_TRUNK)
+            time.sleep(5)
             node.nodetool("upgradesstables")
 
+        time.sleep(10)
+
+        session = self.patient_exclusive_cql_connection(node1)
+        session.execute("SELECT * FROM drop_compact_storage_test.test")
         session.execute("ALTER TABLE drop_compact_storage_test.test DROP COMPACT STORAGE")
+        session.execute("SELECT * FROM drop_compact_storage_test.test")


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