cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zzn...@apache.org
Subject [34/50] cassandra-dtest git commit: Test for CASSANDRA-13559
Date Thu, 13 Jul 2017 00:15:45 GMT
Test for CASSANDRA-13559


Project: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/commit/bbe136cd
Tree: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/tree/bbe136cd
Diff: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/diff/bbe136cd

Branch: refs/heads/master
Commit: bbe136cde81a1752d8922dee24391a24400a5b68
Parents: 7f3566a
Author: Stefania Alborghetti <stefania.alborghetti@datastax.com>
Authored: Thu Jun 1 11:03:54 2017 +0800
Committer: Stefania Alborghetti <stefania.alborghetti@datastax.com>
Committed: Mon Jun 5 09:25:19 2017 +0800

----------------------------------------------------------------------
 upgrade_tests/regression_test.py | 42 ++++++++++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/bbe136cd/upgrade_tests/regression_test.py
----------------------------------------------------------------------
diff --git a/upgrade_tests/regression_test.py b/upgrade_tests/regression_test.py
index cff3c50..613d195 100644
--- a/upgrade_tests/regression_test.py
+++ b/upgrade_tests/regression_test.py
@@ -6,7 +6,8 @@ from unittest import skipUnless
 from cassandra import ConsistencyLevel as CL
 from nose.tools import assert_not_in
 
-from dtest import RUN_STATIC_UPGRADE_MATRIX
+from dtest import RUN_STATIC_UPGRADE_MATRIX, debug
+from tools.decorators import since
 from tools.jmxutils import (JolokiaAgent, make_mbean)
 from upgrade_base import UpgradeTester
 from upgrade_manifest import build_upgrade_pairs
@@ -116,6 +117,45 @@ class TestForRegressions(UpgradeTester):
                 checked = True
         self.assertTrue(checked)
 
+    @since('3.0.14', max_version='3.0.99')
+    def test_schema_agreement(self):
+        """
+        Test that nodes agree on the schema during an upgrade in the 3.0.x series.
+
+        Create a table before upgrading the cluster and wait for schema agreement.
+        Upgrade one node and create one more table, wait for schema agreement and check
+        the schema versions with nodetool describecluster.
+
+        We know that schemas will not necessarily agree from 2.1/2.2 to 3.0.x or from 3.0.x
to 3.x
+        and upwards, so we only test the 3.0.x series for now. We start with 3.0.13 because
+        there is a problem in 3.0.13, see CASSANDRA-12213 and 13559.
+
+        @jira_ticket CASSANDRA-13559
+        """
+        session = self.prepare(nodes=5)
+        session.execute("CREATE TABLE schema_agreement_test_1 ( id int PRIMARY KEY, value
text )")
+        session.cluster.control_connection.wait_for_schema_agreement(wait_time=30)
+
+        def validate_schema_agreement(n, is_upgr):
+            debug("querying node {} for schema information, upgraded: {}".format(n.name,
is_upgr))
+
+            response = n.nodetool('describecluster').stdout
+            debug(response)
+            schemas = response.split('Schema versions:')[1].strip()
+            num_schemas = len(re.findall('\[.*?\]', schemas))
+            self.assertEqual(num_schemas, 1, "There were multiple schema versions during
an upgrade: {}"
+                             .format(schemas))
+
+        for node in self.cluster.nodelist():
+            validate_schema_agreement(node, False)
+
+        for is_upgraded, session, node in self.do_upgrade(session, return_nodes=True):
+            validate_schema_agreement(node, is_upgraded)
+            if is_upgraded:
+                session.execute("CREATE TABLE schema_agreement_test_2 ( id int PRIMARY KEY,
value text )")
+                session.cluster.control_connection.wait_for_schema_agreement(wait_time=30)
+                validate_schema_agreement(node, is_upgraded)
+
     def compact_sstable(self, node, sstable):
         mbean = make_mbean('db', type='CompactionManager')
         with JolokiaAgent(node) as jmx:


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


Mime
View raw message