Github user ifesdjeen commented on a diff in the pull request:

    https://github.com/apache/cassandra-dtest/pull/9#discussion_r149322322
  
    --- Diff: upgrade_tests/upgrade_compact_storage.py ---
    @@ -0,0 +1,177 @@
    +# coding: utf-8
    +
    +import time
    +
    +from cassandra.query import dict_factory
    +from nose.tools import assert_equal, assert_true
    +from ccmlib.node import NodeError
    +
    +from dtest import Tester, debug
    +from cassandra.protocol import ConfigurationException
    +from tools.decorators import since
    +
    +VERSION_311 = 'git:cassandra-3.11'
    +VERSION_TRUNK = 'git:trunk'
    +
    +
    +@since('4.0')
    +class UpgradeSuperColumnsThrough(Tester):
    +    def upgrade_to_version(self, tag, start_rpc=True, wait=True, 
nodes=None):
    +        debug('Upgrading to ' + tag)
    +        if nodes is None:
    +            nodes = self.cluster.nodelist()
    +
    +        for node in nodes:
    +            debug('Shutting down node: ' + node.name)
    +            node.drain()
    +            node.watch_log_for("DRAINED")
    +            node.stop(wait_other_notice=False)
    +
    +        # Update Cassandra Directory
    +        for node in nodes:
    +            node.set_install_dir(version=tag)
    +            debug("Set new cassandra dir for %s: %s" % (node.name, 
node.get_install_dir()))
    +        self.cluster.set_install_dir(version=tag)
    +
    +        # Restart nodes on new version
    +        for node in nodes:
    +            debug('Starting %s on new version (%s)' % (node.name, tag))
    +            node.start(wait_other_notice=wait, wait_for_binary_proto=wait)
    +
    +    def prepare(self, num_nodes=1, 
cassandra_version="github:apache/cassandra-2.2"):
    +        cluster = self.cluster
    +
    +        # Forcing cluster version on purpose
    +        cluster.set_install_dir(version=cassandra_version)
    +
    +        cluster.populate(num_nodes)
    +
    +        cluster.start()
    +        return cluster
    +
    +    def upgrade_compact_storage_test(self):
    +        cluster = 
self.prepare(cassandra_version='github:apache/cassandra-3.0')
    +        node = self.cluster.nodelist()[0]
    +        cursor = self.patient_cql_connection(node, 
row_factory=dict_factory)
    +
    +        cursor.execute("CREATE KEYSPACE ks WITH replication = {'class': 
'SimpleStrategy','replication_factor': '1' };")
    +        cursor.execute("CREATE TABLE ks.compact_table (pk int PRIMARY KEY, 
col1 int, col2 int) WITH COMPACT STORAGE")
    +
    +        for i in xrange(1, 5):
    +            cursor.execute("INSERT INTO ks.compact_table (pk, col1, col2) 
VALUES ({i}, {i}, {i})".format(i=i))
    +
    +        self.upgrade_to_version(VERSION_TRUNK, wait=False)
    +        self.allow_log_errors = True
    +
    +        time.sleep(5)
    +        # After restart, it won't start
    +        errors = len(node.grep_log("Compact Tables are not allowed in 
Cassandra starting with 4.0 version"))
    +        assert_true(errors > 0)
    +
    +    def mixed_cluster_test(self):
    +        cluster = self.prepare(num_nodes=2, cassandra_version=VERSION_311)
    +        node1 = self.cluster.nodelist()[0]
    +        node2 = self.cluster.nodelist()[1]
    +
    +        node1.drain()
    +        node1.watch_log_for("DRAINED")
    +        node1.stop(wait_other_notice=False)
    +        node1.set_install_dir(version=VERSION_TRUNK)
    +        node1.start(wait_other_notice=True, wait_for_binary_proto=True)
    +
    +        cursor = self.patient_cql_connection(node2, 
row_factory=dict_factory)
    --- End diff --
    
    Right, was a copy-paste from `upgrade_tests/thrift_upgrade_test.py`, you 
might want to change it there, too.


---

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

Reply via email to