Fix incorrect [2.1 <- 3.0] serialization of counter cells created in 2.0

Also fixes calculation of legacy counter update cells' serialized size.

patch by Aleksey Yeschenko; reviewed by Sylvain Lebresne for CASSANDRA-13691


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

Branch: refs/heads/master
Commit: 55c4ca8bd450b81da6eed5055981b629b55dea15
Parents: d9c8ceb
Author: Aleksey Yeschenko <alek...@apache.org>
Authored: Sat Jul 15 01:21:04 2017 -0700
Committer: Aleksey Yeschenko <alek...@yeschenko.com>
Committed: Tue Aug 1 15:43:34 2017 +0100

----------------------------------------------------------------------
 counter_tests.py | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/55c4ca8b/counter_tests.py
----------------------------------------------------------------------
diff --git a/counter_tests.py b/counter_tests.py
index 80e6eca..c377060 100644
--- a/counter_tests.py
+++ b/counter_tests.py
@@ -13,6 +13,67 @@ from tools.decorators import since
 
 class TestCounters(Tester):
 
+    @since('3.0', max_version='3.12')
+    def test_13691(self):
+        """
+        2.0 -> 2.1 -> 3.0 counters upgrade test
+        @jira_ticket CASSANDRA-13691
+        """
+        cluster = self.cluster
+        default_install_dir = cluster.get_install_dir()
+
+        #
+        # set up a 2.0 cluster with 3 nodes and set up schema
+        #
+
+        cluster.set_install_dir(version='2.0.17')
+        cluster.populate(3)
+        cluster.start()
+
+        node1, node2, node3 = cluster.nodelist()
+
+        session = self.patient_cql_connection(node1)
+        session.execute("""
+            CREATE KEYSPACE test
+                WITH replication = {'class': 'SimpleStrategy', 
'replication_factor': 3};
+            """)
+        session.execute("CREATE TABLE test.test (id int PRIMARY KEY, c 
counter);")
+
+        #
+        # generate some 2.0 counter columns with local shards
+        #
+
+        query = "UPDATE test.test SET c = c + 1 WHERE id = ?"
+        prepared = session.prepare(query)
+        for i in range(0, 1000):
+            session.execute(prepared, [i])
+
+        cluster.flush()
+        cluster.stop()
+
+        #
+        # upgrade cluster to 2.1
+        #
+
+        cluster.set_install_dir(version='2.1.17')
+        cluster.start();
+        cluster.nodetool("upgradesstables")
+
+        #
+        # upgrade node3 to current (3.0.x or 3.11.x)
+        #
+
+        node3.stop(wait_other_notice=True)
+        node3.set_install_dir(install_dir=default_install_dir)
+        node3.start(wait_other_notice=True)
+
+        #
+        # with a 2.1 coordinator, try to read the table with CL.ALL
+        #
+
+        session = self.patient_cql_connection(node1, 
consistency_level=ConsistencyLevel.ALL)
+        assert_one(session, "SELECT COUNT(*) FROM test.test", [1000])
+
     def simple_increment_test(self):
         """ Simple incrementation test (Created for #3465, that wasn't a bug) 
"""
         cluster = self.cluster


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

Reply via email to