You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by zz...@apache.org on 2017/07/13 00:15:12 UTC

[01/50] cassandra-dtest git commit: Merge pull request #1448 from stef1927/13071

Repository: cassandra-dtest
Updated Branches:
  refs/heads/master [created] f1b0ba8a1


Merge pull request #1448 from stef1927/13071

New test for CASSANDRA-13071

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

Branch: refs/heads/master
Commit: 6bb074f7c00a0067128c19845175da2868483f9f
Parents: 495165a 87872e5
Author: Stefania Alborghetti <st...@datastax.com>
Authored: Thu Mar 2 10:03:59 2017 +0800
Committer: GitHub <no...@github.com>
Committed: Thu Mar 2 10:03:59 2017 +0800

----------------------------------------------------------------------
 cqlsh_tests/cqlsh_copy_tests.py | 87 ++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)
----------------------------------------------------------------------



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


[50/50] cassandra-dtest git commit: Revert "Adds the ability to use uncompressed chunks in compressed files"

Posted by zz...@apache.org.
Revert "Adds the ability to use uncompressed chunks in compressed files"

This reverts commit 058b95289bf815495fced0ac55a78bcceceea9fa.


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

Branch: refs/heads/master
Commit: f1b0ba8a1d60937b79ccac43b23c887da8ced32a
Parents: 6f4e41e
Author: Joel Knighton <jo...@datastax.com>
Authored: Wed Jul 12 12:11:02 2017 -0500
Committer: Joel Knighton <jo...@datastax.com>
Committed: Wed Jul 12 12:11:02 2017 -0500

----------------------------------------------------------------------
 cqlsh_tests/cqlsh_tests.py | 44 ++---------------------------------------
 1 file changed, 2 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/f1b0ba8a/cqlsh_tests/cqlsh_tests.py
----------------------------------------------------------------------
diff --git a/cqlsh_tests/cqlsh_tests.py b/cqlsh_tests/cqlsh_tests.py
index dee1891..e7bc11c 100644
--- a/cqlsh_tests/cqlsh_tests.py
+++ b/cqlsh_tests/cqlsh_tests.py
@@ -847,25 +847,7 @@ VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, blobAsBoolean(0x), blobAsDec
                 PRIMARY KEY (id, col)
                 """
 
-        if self.cluster.version() >= LooseVersion('4.0'):
-            ret += """
-        ) WITH CLUSTERING ORDER BY (col ASC)
-            AND bloom_filter_fp_chance = 0.01
-            AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
-            AND comment = ''
-            AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
-            AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor', 'min_compress_ratio': '1.1'}
-            AND crc_check_chance = 1.0
-            AND dclocal_read_repair_chance = 0.1
-            AND default_time_to_live = 0
-            AND gc_grace_seconds = 864000
-            AND max_index_interval = 2048
-            AND memtable_flush_period_in_ms = 0
-            AND min_index_interval = 128
-            AND read_repair_chance = 0.0
-            AND speculative_retry = '99PERCENTILE';
-        """
-        elif self.cluster.version() >= LooseVersion('3.9'):
+        if self.cluster.version() >= LooseVersion('3.9'):
             ret += """
         ) WITH CLUSTERING ORDER BY (col ASC)
             AND bloom_filter_fp_chance = 0.01
@@ -931,29 +913,7 @@ VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, blobAsBoolean(0x), blobAsDec
             return ret + "\n" + col_idx_def
 
     def get_users_table_output(self):
-        if self.cluster.version() >= LooseVersion('4.0'):
-            return """
-        CREATE TABLE test.users (
-            userid text PRIMARY KEY,
-            age int,
-            firstname text,
-            lastname text
-        ) WITH bloom_filter_fp_chance = 0.01
-            AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
-            AND comment = ''
-            AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
-            AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor', 'min_compress_ratio': '1.1'}
-            AND crc_check_chance = 1.0
-            AND dclocal_read_repair_chance = 0.1
-            AND default_time_to_live = 0
-            AND gc_grace_seconds = 864000
-            AND max_index_interval = 2048
-            AND memtable_flush_period_in_ms = 0
-            AND min_index_interval = 128
-            AND read_repair_chance = 0.0
-            AND speculative_retry = '99PERCENTILE';
-        """ + self.get_index_output('myindex', 'test', 'users', 'age')
-        elif self.cluster.version() >= LooseVersion('3.9'):
+        if self.cluster.version() >= LooseVersion('3.9'):
             return """
         CREATE TABLE test.users (
             userid text PRIMARY KEY,


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


[28/50] cassandra-dtest git commit: Fix version check after C* ticket was committed

Posted by zz...@apache.org.
Fix version check after C* ticket was committed


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

Branch: refs/heads/master
Commit: 5c99d2028d1b03c2543dd81b90700922aa9ec93b
Parents: afda2d4
Author: Sam Tunnicliffe <sa...@beobal.com>
Authored: Thu May 11 18:33:47 2017 +0100
Committer: Philip Thompson <pt...@gmail.com>
Committed: Thu May 11 14:24:05 2017 -0400

----------------------------------------------------------------------
 cqlsh_tests/cqlsh_tests.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/5c99d202/cqlsh_tests/cqlsh_tests.py
----------------------------------------------------------------------
diff --git a/cqlsh_tests/cqlsh_tests.py b/cqlsh_tests/cqlsh_tests.py
index 4feadc1..e7bc11c 100644
--- a/cqlsh_tests/cqlsh_tests.py
+++ b/cqlsh_tests/cqlsh_tests.py
@@ -984,12 +984,12 @@ VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, blobAsBoolean(0x), blobAsDec
 
     def get_index_output(self, index, ks, table, col):
         # a quoted index name (e.g. "FooIndex") is only correctly echoed by DESCRIBE
-        # from 3.0.11 & 3.10
+        # from 3.0.14 & 3.11
         if index[0] == '"' and index[-1] == '"':
             version = self.cluster.version()
-            if version >= LooseVersion('3.10'):
+            if version >= LooseVersion('3.11'):
                 pass
-            elif LooseVersion('3.1') > version >= LooseVersion('3.0.11'):
+            elif LooseVersion('3.1') > version >= LooseVersion('3.0.14'):
                 pass
             else:
                 index = index[1:-1]


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


[11/50] cassandra-dtest git commit: Update current branch versions in upgrade manifest

Posted by zz...@apache.org.
Update current branch versions in upgrade manifest


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

Branch: refs/heads/master
Commit: ee6aa78f34390070b62c0d991d14fb018565f57e
Parents: 795d91c
Author: Joel Knighton <jo...@datastax.com>
Authored: Thu Mar 30 16:57:30 2017 -0500
Committer: Philip Thompson <pt...@gmail.com>
Committed: Fri Mar 31 10:58:10 2017 -0400

----------------------------------------------------------------------
 upgrade_tests/upgrade_manifest.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/ee6aa78f/upgrade_tests/upgrade_manifest.py
----------------------------------------------------------------------
diff --git a/upgrade_tests/upgrade_manifest.py b/upgrade_tests/upgrade_manifest.py
index 6873127..d5ed776 100644
--- a/upgrade_tests/upgrade_manifest.py
+++ b/upgrade_tests/upgrade_manifest.py
@@ -67,13 +67,13 @@ indev_2_0_x = None  # None if release not likely
 current_2_0_x = VersionMeta(name='current_2_0_x', family='2.0.x', variant='current', version='2.0.17', min_proto_v=1, max_proto_v=2, java_versions=(7,))
 
 indev_2_1_x = VersionMeta(name='indev_2_1_x', family='2.1.x', variant='indev', version='github:apache/cassandra-2.1', min_proto_v=1, max_proto_v=3, java_versions=(7, 8))
-current_2_1_x = VersionMeta(name='current_2_1_x', family='2.1.x', variant='current', version='2.1.15', min_proto_v=1, max_proto_v=3, java_versions=(7, 8))
+current_2_1_x = VersionMeta(name='current_2_1_x', family='2.1.x', variant='current', version='2.1.17', min_proto_v=1, max_proto_v=3, java_versions=(7, 8))
 
 indev_2_2_x = VersionMeta(name='indev_2_2_x', family='2.2.x', variant='indev', version='github:apache/cassandra-2.2', min_proto_v=1, max_proto_v=4, java_versions=(7, 8))
-current_2_2_x = VersionMeta(name='current_2_2_x', family='2.2.x', variant='current', version='2.2.8', min_proto_v=1, max_proto_v=4, java_versions=(7, 8))
+current_2_2_x = VersionMeta(name='current_2_2_x', family='2.2.x', variant='current', version='2.2.9', min_proto_v=1, max_proto_v=4, java_versions=(7, 8))
 
 indev_3_0_x = VersionMeta(name='indev_3_0_x', family='3.0.x', variant='indev', version='github:apache/cassandra-3.0', min_proto_v=3, max_proto_v=4, java_versions=(8,))
-current_3_0_x = VersionMeta(name='current_3_0_x', family='3.0.x', variant='current', version='3.0.9', min_proto_v=3, max_proto_v=4, java_versions=(8,))
+current_3_0_x = VersionMeta(name='current_3_0_x', family='3.0.x', variant='current', version='3.0.12', min_proto_v=3, max_proto_v=4, java_versions=(8,))
 
 indev_3_x = VersionMeta(name='indev_3_x', family='3.x', variant='indev', version='github:apache/cassandra-3.11', min_proto_v=3, max_proto_v=4, java_versions=(8,))
 current_3_x = VersionMeta(name='current_3_x', family='3.x', variant='current', version='3.10', min_proto_v=3, max_proto_v=4, java_versions=(8,))


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


[25/50] cassandra-dtest git commit: New test for CASSANDRA-11720; Changing `max_hint_window_in_ms` at runtime

Posted by zz...@apache.org.
New test for CASSANDRA-11720; Changing `max_hint_window_in_ms` at runtime


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

Branch: refs/heads/master
Commit: 6540ba4be1623e330376895e263030f4811e2048
Parents: dc8cb3f
Author: mck <mi...@thelastpickle.com>
Authored: Wed May 3 12:02:08 2017 +1000
Committer: Philip Thompson <pt...@gmail.com>
Committed: Wed May 10 19:58:51 2017 -0400

----------------------------------------------------------------------
 hintedhandoff_test.py | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/6540ba4b/hintedhandoff_test.py
----------------------------------------------------------------------
diff --git a/hintedhandoff_test.py b/hintedhandoff_test.py
index 7fb8e20..1ed3305 100644
--- a/hintedhandoff_test.py
+++ b/hintedhandoff_test.py
@@ -42,13 +42,13 @@ class TestHintedHandoffConfig(Tester):
         self.assertEqual('', err)
         return out
 
-    def _do_hinted_handoff(self, node1, node2, enabled):
+    def _do_hinted_handoff(self, node1, node2, enabled, keyspace='ks'):
         """
         Test that if we stop one node the other one
         will store hints only when hinted handoff is enabled
         """
         session = self.patient_exclusive_cql_connection(node1)
-        create_ks(session, 'ks', 2)
+        create_ks(session, keyspace, 2)
         create_c1c2_table(self, session)
 
         node2.stop(wait_other_notice=True)
@@ -64,7 +64,7 @@ class TestHintedHandoffConfig(Tester):
         node1.stop(wait_other_notice=True)
 
         # Check node2 for all the keys that should have been delivered via HH if enabled or not if not enabled
-        session = self.patient_exclusive_cql_connection(node2, keyspace='ks')
+        session = self.patient_exclusive_cql_connection(node2, keyspace=keyspace)
         for n in xrange(0, 100):
             if enabled:
                 query_c1c2(session, n, ConsistencyLevel.ONE)
@@ -121,6 +121,25 @@ class TestHintedHandoffConfig(Tester):
 
         self._do_hinted_handoff(node1, node2, True)
 
+    def hintedhandoff_setmaxwindow_test(self):
+        """
+        Test global hinted handoff against max_hint_window_in_ms update via nodetool
+        """
+        node1, node2 = self._start_two_node_cluster({'hinted_handoff_enabled': True, "max_hint_window_in_ms": 300000})
+
+        for node in node1, node2:
+            res = self._launch_nodetool_cmd(node, 'statushandoff')
+            self.assertEqual('Hinted handoff is running', res.rstrip())
+
+        res = self._launch_nodetool_cmd(node, 'getmaxhintwindow')
+        self.assertEqual('Current max hint window: 300000 ms', res.rstrip())
+        self._do_hinted_handoff(node1, node2, True)
+        node1.start(wait_other_notice=True)
+        self._launch_nodetool_cmd(node, 'setmaxhintwindow 1')
+        res = self._launch_nodetool_cmd(node, 'getmaxhintwindow')
+        self.assertEqual('Current max hint window: 1 ms', res.rstrip())
+        self._do_hinted_handoff(node1, node2, False, keyspace='ks2')
+
     def hintedhandoff_dc_disabled_test(self):
         """
         Test global hinted handoff enabled with the dc disabled


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


[19/50] cassandra-dtest git commit: added tests for mutual auth (require_client_auth) on internode connections

Posted by zz...@apache.org.
added tests for mutual auth (require_client_auth) on internode connections


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

Branch: refs/heads/master
Commit: 8513c4784fb9b7bcf54118f0f5b173c93b62978c
Parents: 704c7b0
Author: Jason Brown <ja...@gmail.com>
Authored: Thu Apr 6 06:25:34 2017 -0700
Committer: Philip Thompson <pt...@gmail.com>
Committed: Thu Apr 6 15:13:11 2017 -0400

----------------------------------------------------------------------
 sslnodetonode_test.py | 40 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/8513c478/sslnodetonode_test.py
----------------------------------------------------------------------
diff --git a/sslnodetonode_test.py b/sslnodetonode_test.py
index a2a3e41..c4a9184 100644
--- a/sslnodetonode_test.py
+++ b/sslnodetonode_test.py
@@ -10,6 +10,7 @@ from tools.decorators import since
 _LOG_ERR_SIG = "^javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: Certificate signature validation failed$"
 _LOG_ERR_IP = "^javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names matching IP address [0-9.]+ found$"
 _LOG_ERR_HOST = "^javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching \S+ found$"
+_LOG_ERR_CERT = "^javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown$"
 
 
 @since('3.6')
@@ -56,6 +57,40 @@ class TestNodeToNodeSSLEncryption(Tester):
         self.cluster.stop()
         self.assertTrue(found)
 
+    def ssl_client_auth_required_fail_test(self):
+        """peers need to perform mutual auth (cient auth required), but do not supply the local cert"""
+
+        credNode1 = sslkeygen.generate_credentials("127.0.0.1")
+        credNode2 = sslkeygen.generate_credentials("127.0.0.2")
+
+        self.setup_nodes(credNode1, credNode2, client_auth=True)
+
+        self.allow_log_errors = True
+        self.cluster.start(no_wait=True)
+        time.sleep(2)
+
+        found = self._grep_msg(self.node1, _LOG_ERR_CERT)
+        self.assertTrue(found)
+
+        found = self._grep_msg(self.node2, _LOG_ERR_CERT)
+        self.assertTrue(found)
+
+        self.cluster.stop()
+        self.assertTrue(found)
+
+    def ssl_client_auth_required_succeed_test(self):
+        """peers need to perform mutual auth (cient auth required), but do not supply the loca cert"""
+
+        credNode1 = sslkeygen.generate_credentials("127.0.0.1")
+        credNode2 = sslkeygen.generate_credentials("127.0.0.2", credNode1.cakeystore, credNode1.cacert)
+        sslkeygen.import_cert(credNode1.basedir, 'ca127.0.0.2', credNode2.cacert, credNode1.cakeystore)
+        sslkeygen.import_cert(credNode2.basedir, 'ca127.0.0.1', credNode1.cacert, credNode2.cakeystore)
+
+        self.setup_nodes(credNode1, credNode2, client_auth=True)
+
+        self.cluster.start()
+        self.cql_connection(self.node1)
+
     def ca_mismatch_test(self):
         """CA mismatch should cause nodes to fail to connect"""
 
@@ -88,7 +123,7 @@ class TestNodeToNodeSSLEncryption(Tester):
 
         return False
 
-    def setup_nodes(self, credentials1, credentials2, endpointVerification=False):
+    def setup_nodes(self, credentials1, credentials2, endpointVerification=False, client_auth=False):
 
         cluster = self.cluster
 
@@ -107,7 +142,8 @@ class TestNodeToNodeSSLEncryption(Tester):
                     'keystore_password': 'cassandra',
                     'truststore': tspath,
                     'truststore_password': 'cassandra',
-                    'require_endpoint_verification': endpointVerification
+                    'require_endpoint_verification': endpointVerification,
+                    'require_client_auth': client_auth
                 }
             })
 


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


[24/50] cassandra-dtest git commit: adding cluster reconfiguration tests for 9143 (#1468)

Posted by zz...@apache.org.
adding cluster reconfiguration tests for 9143 (#1468)

* adding cluster reconfiguration tests for 9143

* fixing blank line

* fixing whitespace issue


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

Branch: refs/heads/master
Commit: dc8cb3fb12cad229131b57eb789e41246a108924
Parents: d5c413c
Author: Blake Eggleston <bd...@gmail.com>
Authored: Tue May 9 16:33:08 2017 -0700
Committer: Philip Thompson <pt...@gmail.com>
Committed: Tue May 9 19:33:08 2017 -0400

----------------------------------------------------------------------
 repair_tests/incremental_repair_test.py | 113 ++++++++++++++++++++++++++-
 1 file changed, 112 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/dc8cb3fb/repair_tests/incremental_repair_test.py
----------------------------------------------------------------------
diff --git a/repair_tests/incremental_repair_test.py b/repair_tests/incremental_repair_test.py
index 270e1fa..a447d56 100644
--- a/repair_tests/incremental_repair_test.py
+++ b/repair_tests/incremental_repair_test.py
@@ -14,7 +14,8 @@ from nose.plugins.attrib import attr
 from dtest import Tester, debug, create_ks, create_cf
 from tools.assertions import assert_almost_equal, assert_one
 from tools.data import insert_c1c2
-from tools.decorators import since
+from tools.decorators import since, no_vnodes
+from tools.misc import new_node
 
 
 class ConsistentState(object):
@@ -647,3 +648,113 @@ class TestIncRepair(Tester):
 
         for out in (node.run_sstablemetadata(keyspace='keyspace1').stdout for node in cluster.nodelist() if len(node.get_sstables('keyspace1', 'standard1')) > 0):
             self.assertNotIn('Repaired at: 0', out)
+
+    @no_vnodes()
+    @since('4.0')
+    def move_test(self):
+        """ Test repaired data remains in sync after a move """
+        cluster = self.cluster
+        cluster.set_configuration_options(values={'hinted_handoff_enabled': False, 'commitlog_sync_period_in_ms': 500})
+        cluster.populate(4, tokens=[0, 2**32, 2**48, -(2**32)]).start()
+        node1, node2, node3, node4 = cluster.nodelist()
+
+        session = self.patient_exclusive_cql_connection(node3)
+        session.execute("CREATE KEYSPACE ks WITH REPLICATION={'class':'SimpleStrategy', 'replication_factor': 2}")
+        session.execute("CREATE TABLE ks.tbl (k INT PRIMARY KEY, v INT)")
+
+        # insert some data
+        stmt = SimpleStatement("INSERT INTO ks.tbl (k,v) VALUES (%s, %s)")
+        for i in range(1000):
+            session.execute(stmt, (i, i))
+
+        node1.repair(options=['ks'])
+
+        for i in range(1000):
+            v = i + 1000
+            session.execute(stmt, (v, v))
+
+        # everything should be in sync
+        for node in cluster.nodelist():
+            result = node.repair(options=['ks', '--validate'])
+            self.assertIn("Repaired data is in sync", result.stdout)
+
+        node2.nodetool('move {}'.format(2**16))
+
+        # everything should still be in sync
+        for node in cluster.nodelist():
+            result = node.repair(options=['ks', '--validate'])
+            self.assertIn("Repaired data is in sync", result.stdout)
+
+    @no_vnodes()
+    @since('4.0')
+    def decommission_test(self):
+        """ Test repaired data remains in sync after a decommission """
+        cluster = self.cluster
+        cluster.set_configuration_options(values={'hinted_handoff_enabled': False, 'commitlog_sync_period_in_ms': 500})
+        cluster.populate(4).start()
+        node1, node2, node3, node4 = cluster.nodelist()
+
+        session = self.patient_exclusive_cql_connection(node3)
+        session.execute("CREATE KEYSPACE ks WITH REPLICATION={'class':'SimpleStrategy', 'replication_factor': 2}")
+        session.execute("CREATE TABLE ks.tbl (k INT PRIMARY KEY, v INT)")
+
+        # insert some data
+        stmt = SimpleStatement("INSERT INTO ks.tbl (k,v) VALUES (%s, %s)")
+        for i in range(1000):
+            session.execute(stmt, (i, i))
+
+        node1.repair(options=['ks'])
+
+        for i in range(1000):
+            v = i + 1000
+            session.execute(stmt, (v, v))
+
+        # everything should be in sync
+        for node in cluster.nodelist():
+            result = node.repair(options=['ks', '--validate'])
+            self.assertIn("Repaired data is in sync", result.stdout)
+
+        node2.nodetool('decommission')
+
+        # everything should still be in sync
+        for node in [node1, node3, node4]:
+            result = node.repair(options=['ks', '--validate'])
+            self.assertIn("Repaired data is in sync", result.stdout)
+
+    @no_vnodes()
+    @since('4.0')
+    def bootstrap_test(self):
+        """ Test repaired data remains in sync after a bootstrap """
+        cluster = self.cluster
+        cluster.set_configuration_options(values={'hinted_handoff_enabled': False, 'commitlog_sync_period_in_ms': 500})
+        cluster.populate(3).start()
+        node1, node2, node3 = cluster.nodelist()
+
+        session = self.patient_exclusive_cql_connection(node3)
+        session.execute("CREATE KEYSPACE ks WITH REPLICATION={'class':'SimpleStrategy', 'replication_factor': 2}")
+        session.execute("CREATE TABLE ks.tbl (k INT PRIMARY KEY, v INT)")
+
+        # insert some data
+        stmt = SimpleStatement("INSERT INTO ks.tbl (k,v) VALUES (%s, %s)")
+        for i in range(1000):
+            session.execute(stmt, (i, i))
+
+        node1.repair(options=['ks'])
+
+        for i in range(1000):
+            v = i + 1000
+            session.execute(stmt, (v, v))
+
+        # everything should be in sync
+        for node in [node1, node2, node3]:
+            result = node.repair(options=['ks', '--validate'])
+            self.assertIn("Repaired data is in sync", result.stdout)
+
+        node4 = new_node(self.cluster)
+        node4.start(wait_for_binary_proto=True)
+
+        self.assertEqual(len(self.cluster.nodelist()), 4)
+        # everything should still be in sync
+        for node in self.cluster.nodelist():
+            result = node.repair(options=['ks', '--validate'])
+            self.assertIn("Repaired data is in sync", result.stdout)


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


[15/50] cassandra-dtest git commit: set max_version since deprecated repair methods are removed in 4.0

Posted by zz...@apache.org.
set max_version since deprecated repair methods are removed in 4.0


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

Branch: refs/heads/master
Commit: b93fd83170cb880155208be4a5b10a1e0ba041dc
Parents: c17e011
Author: Yuki Morishita <mo...@gmail.com>
Authored: Fri Mar 17 17:45:10 2017 +0900
Committer: Joel Knighton <jo...@gmail.com>
Committed: Mon Apr 3 23:58:50 2017 -0500

----------------------------------------------------------------------
 repair_tests/deprecated_repair_test.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/b93fd831/repair_tests/deprecated_repair_test.py
----------------------------------------------------------------------
diff --git a/repair_tests/deprecated_repair_test.py b/repair_tests/deprecated_repair_test.py
index 6ae0d09..4b33842 100644
--- a/repair_tests/deprecated_repair_test.py
+++ b/repair_tests/deprecated_repair_test.py
@@ -11,7 +11,7 @@ from tools.jmxutils import (JolokiaAgent, make_mbean,
                             remove_perf_disable_shared_mem)
 
 
-@since("2.2")
+@since("2.2", max_version="4")
 class TestDeprecatedRepairAPI(Tester):
     """
     @jira_ticket CASSANDRA-9570


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


[43/50] cassandra-dtest git commit: Add dtests for compatibility flag introduced in CASSANDRA-13004 (#1485)

Posted by zz...@apache.org.
Add dtests for compatibility flag introduced in CASSANDRA-13004 (#1485)

Add dtests for compatibility flag introduced in CASSANDRA-13004

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

Branch: refs/heads/master
Commit: 6847bc10c2a3fa3ee911b0cf3826920bc4dbad18
Parents: c368a90
Author: Alex Petrov <al...@coffeenco.de>
Authored: Tue Jun 20 20:25:51 2017 +0200
Committer: GitHub <no...@github.com>
Committed: Tue Jun 20 20:25:51 2017 +0200

----------------------------------------------------------------------
 upgrade_tests/compatibility_flag_test.py | 132 ++++++++++++++++++++++++++
 1 file changed, 132 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/6847bc10/upgrade_tests/compatibility_flag_test.py
----------------------------------------------------------------------
diff --git a/upgrade_tests/compatibility_flag_test.py b/upgrade_tests/compatibility_flag_test.py
new file mode 100644
index 0000000..1abeaef
--- /dev/null
+++ b/upgrade_tests/compatibility_flag_test.py
@@ -0,0 +1,132 @@
+from dtest import Tester, debug
+from tools.assertions import assert_all
+from tools.decorators import since
+
+
+class CompatibilityFlagTest(Tester):
+    """
+    Test 30 protocol compatibility flag
+
+    @jira CASSANDRA-13004
+    """
+
+    def _compatibility_flag_off_with_30_node_test(self, from_version):
+        """
+        Test compatibility with 30 protocol version: if the flag is unset, schema agreement can not be reached
+        """
+
+        cluster = self.cluster
+        cluster.populate(2)
+        node1, node2 = cluster.nodelist()
+        cluster.set_install_dir(version=from_version)
+        cluster.start(wait_for_binary_proto=True)
+
+        node1.drain()
+        node1.watch_log_for("DRAINED")
+        node1.stop(wait_other_notice=False)
+        debug("Upgrading to current version")
+        self.set_node_to_current_version(node1)
+        node1.start(wait_for_binary_proto=True)
+
+        node1.watch_log_for("Not pulling schema because versions match or shouldPullSchemaFrom returned false", filename='debug.log')
+        node2.watch_log_for("Not pulling schema because versions match or shouldPullSchemaFrom returned false", filename='debug.log')
+
+    def _compatibility_flag_on_with_30_test(self, from_version):
+        """
+        Test compatibility with 30 protocol version: if the flag is set, schema agreement can be reached
+        """
+
+        cluster = self.cluster
+        cluster.populate(2)
+        node1, node2 = cluster.nodelist()
+        cluster.set_install_dir(version=from_version)
+        cluster.start(wait_for_binary_proto=True)
+
+        node1.drain()
+        node1.watch_log_for("DRAINED")
+        node1.stop(wait_other_notice=False)
+        debug("Upgrading to current version")
+        self.set_node_to_current_version(node1)
+        node1.start(jvm_args=["-Dcassandra.force_3_0_protocol_version=true"], wait_for_binary_proto=True)
+
+        session = self.patient_cql_connection(node1)
+        self._run_test(session)
+
+    def _compatibility_flag_on_3014_test(self):
+        """
+        Test compatibility between post-13004 nodes, one of which is in compatibility mode
+        """
+
+        cluster = self.cluster
+        cluster.populate(2)
+        node1, node2 = cluster.nodelist()
+
+        node1.start(wait_for_binary_proto=True)
+        node2.start(jvm_args=["-Dcassandra.force_3_0_protocol_version=true"], wait_for_binary_proto=True)
+
+        session = self.patient_cql_connection(node1)
+        self._run_test(session)
+
+    def _compatibility_flag_off_3014_test(self):
+        """
+        Test compatibility between post-13004 nodes
+        """
+
+        cluster = self.cluster
+        cluster.populate(2)
+        node1, node2 = cluster.nodelist()
+
+        node1.start(wait_for_binary_proto=True)
+        node2.start(wait_for_binary_proto=True)
+
+        session = self.patient_cql_connection(node1)
+        self._run_test(session)
+
+    def _run_test(self, session):
+        # Make sure the system_auth table will get replicated to the node that we're going to replace
+
+        session.execute("CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '2'} ;")
+        session.execute("CREATE TABLE test.test (a text PRIMARY KEY, b text, c text);")
+
+        for i in range(1, 6):
+            session.execute("INSERT INTO test.test (a, b, c) VALUES ('{}', '{}', '{}');".format(i, i + 1, i + 2))
+
+        assert_all(session,
+                   "SELECT * FROM test.test",
+                   [[str(i), str(i + 1), str(i + 2)] for i in range(1, 6)], ignore_order=True)
+
+        assert_all(session,
+                   "SELECT a,c FROM test.test",
+                   [[str(i), str(i + 2)] for i in range(1, 6)], ignore_order=True)
+
+
+@since('3.0.14', max_version='3.0.x')
+class CompatibilityFlag30XTest(CompatibilityFlagTest):
+
+    def compatibility_flag_off_with_30_node_test(self):
+        self._compatibility_flag_off_with_30_node_test('3.0.12')
+
+    def compatibility_flag_on_with_3_0_test(self):
+        self._compatibility_flag_on_with_30_test('3.0.12')
+
+    def compatibility_flag_on_3014_test(self):
+        self._compatibility_flag_on_3014_test()
+
+    def compatibility_flag_off_3014_test(self):
+        self._compatibility_flag_off_3014_test()
+
+
+@since('3.11', max_version='4')
+class CompatibilityFlag3XTest(CompatibilityFlagTest):
+
+    def compatibility_flag_off_with_30_node_test(self):
+        self._compatibility_flag_off_with_30_node_test('3.10')
+
+    def compatibility_flag_on_with_3_0_test(self):
+        self._compatibility_flag_on_with_30_test('3.10')
+
+    def compatibility_flag_on_3014_test(self):
+        self._compatibility_flag_on_3014_test()
+
+    def compatibility_flag_off_3014_test(self):
+        self._compatibility_flag_off_3014_test()


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


[26/50] cassandra-dtest git commit: Preserve DESCRIBE behaviour with quoted index names for older versions

Posted by zz...@apache.org.
Preserve DESCRIBE behaviour with quoted index names for older versions


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

Branch: refs/heads/master
Commit: afda2d45fe578359b2db51233c1f12833d8a196b
Parents: f292548
Author: Sam Tunnicliffe <sa...@beobal.com>
Authored: Fri Jan 20 12:40:59 2017 -0800
Committer: Philip Thompson <pt...@gmail.com>
Committed: Thu May 11 14:24:05 2017 -0400

----------------------------------------------------------------------
 cqlsh_tests/cqlsh_tests.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/afda2d45/cqlsh_tests/cqlsh_tests.py
----------------------------------------------------------------------
diff --git a/cqlsh_tests/cqlsh_tests.py b/cqlsh_tests/cqlsh_tests.py
index 7734848..4feadc1 100644
--- a/cqlsh_tests/cqlsh_tests.py
+++ b/cqlsh_tests/cqlsh_tests.py
@@ -682,7 +682,6 @@ VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, blobAsBoolean(0x), blobAsDec
         self.cluster.populate(1)
         self.cluster.start(wait_for_binary_proto=True)
         node1, = self.cluster.nodelist()
-
         self.execute(
             cql="""
                 CREATE KEYSPACE test WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor' : 1};
@@ -980,10 +979,20 @@ VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, blobAsBoolean(0x), blobAsDec
             AND min_index_interval = 128
             AND read_repair_chance = 0.0
             AND speculative_retry = '99.0PERCENTILE';
-        """ + self.get_index_output('"QuotedNameIndex"', 'test', 'users', 'firstname') \
+        """ + self.get_index_output('QuotedNameIndex', 'test', 'users', 'firstname') \
                    + "\n" + self.get_index_output('myindex', 'test', 'users', 'age')
 
     def get_index_output(self, index, ks, table, col):
+        # a quoted index name (e.g. "FooIndex") is only correctly echoed by DESCRIBE
+        # from 3.0.11 & 3.10
+        if index[0] == '"' and index[-1] == '"':
+            version = self.cluster.version()
+            if version >= LooseVersion('3.10'):
+                pass
+            elif LooseVersion('3.1') > version >= LooseVersion('3.0.11'):
+                pass
+            else:
+                index = index[1:-1]
         return "CREATE INDEX {} ON {}.{} ({});".format(index, ks, table, col)
 
     def get_users_by_state_mv_output(self):


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


[05/50] cassandra-dtest git commit: Merge pull request #1451 from tjake/mv-build-wait

Posted by zz...@apache.org.
Merge pull request #1451 from tjake/mv-build-wait

Fix for materialized_views_tests to wait for the build to finish befo…

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

Branch: refs/heads/master
Commit: c6e6a4edc6b2e1e1c346696c29afd89150e49b06
Parents: 13a8ec4 21d4736
Author: Jake Luciani <ja...@gmail.com>
Authored: Thu Mar 9 11:34:04 2017 -0500
Committer: GitHub <no...@github.com>
Committed: Thu Mar 9 11:34:04 2017 -0500

----------------------------------------------------------------------
 materialized_views_test.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------



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


[10/50] cassandra-dtest git commit: Added test case for CASSANDRA-13364

Posted by zz...@apache.org.
Added test case for CASSANDRA-13364


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

Branch: refs/heads/master
Commit: ec6b9581eb8c79edc0cde2f5ad045e6951acfa43
Parents: 795d91c
Author: Stefania Alborghetti <st...@datastax.com>
Authored: Wed Mar 29 11:20:53 2017 +0800
Committer: Stefania Alborghetti <st...@datastax.com>
Committed: Wed Mar 29 11:20:53 2017 +0800

----------------------------------------------------------------------
 cqlsh_tests/cqlsh_copy_tests.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/ec6b9581/cqlsh_tests/cqlsh_copy_tests.py
----------------------------------------------------------------------
diff --git a/cqlsh_tests/cqlsh_copy_tests.py b/cqlsh_tests/cqlsh_copy_tests.py
index d4a49fa..43d33db 100644
--- a/cqlsh_tests/cqlsh_copy_tests.py
+++ b/cqlsh_tests/cqlsh_copy_tests.py
@@ -243,6 +243,7 @@ class CqlshCopyTest(Tester):
                 u frozen<list<list<address_type>>>,
                 v frozen<map<map<int,int>,set<text>>>,
                 w frozen<set<set<inet>>>,
+                x map<text, frozen<list<text>>>
             )''')
 
         default_time_format = self.default_time_format
@@ -337,7 +338,8 @@ class CqlshCopyTest(Tester):
                      # first set is contained in the second set or else they will not sort consistently
                      # and this will cause comparison problems when comparing with csv strings therefore failing
                      # some tests
-                     ImmutableSet([ImmutableSet(['127.0.0.1']), ImmutableSet(['127.0.0.1', '127.0.0.2'])])
+                     ImmutableSet([ImmutableSet(['127.0.0.1']), ImmutableSet(['127.0.0.1', '127.0.0.2'])]),
+                     {'key1': ['value1', 'value2']}  # map<text, frozen<list<text>>>
                      )
 
     @contextmanager
@@ -1727,8 +1729,8 @@ class CqlshCopyTest(Tester):
         self.all_datatypes_prepare()
 
         insert_statement = self.session.prepare(
-            """INSERT INTO testdatatype (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w)
-            VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""")
+            """INSERT INTO testdatatype (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x)
+            VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""")
         self.session.execute(insert_statement, self.data)
 
         def _test(prepared_statements):
@@ -1796,8 +1798,8 @@ class CqlshCopyTest(Tester):
         self.all_datatypes_prepare()
 
         insert_statement = self.session.prepare(
-            """INSERT INTO testdatatype (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w)
-            VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""")
+            """INSERT INTO testdatatype (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x)
+            VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""")
         self.session.execute(insert_statement, self.data)
 
         tempfile = self.get_temp_file()


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


[41/50] cassandra-dtest git commit: Removed cluster reuse from codebase

Posted by zz...@apache.org.
Removed cluster reuse from codebase


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

Branch: refs/heads/master
Commit: 1cc4941916a3df199821f974e47acd667f65c2b8
Parents: 93aa314
Author: MichaelHamm <mi...@gmail.com>
Authored: Mon Jun 19 11:06:13 2017 -0700
Committer: Philip Thompson <pt...@gmail.com>
Committed: Tue Jun 20 12:09:35 2017 +0200

----------------------------------------------------------------------
 INSTALL.md                      |  4 ----
 README.md                       |  3 +--
 cqlsh_tests/cqlsh_copy_tests.py | 24 +-----------------------
 dtest.py                        | 25 -------------------------
 upgrade_tests/cql_tests.py      | 14 +-------------
 5 files changed, 3 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/1cc49419/INSTALL.md
----------------------------------------------------------------------
diff --git a/INSTALL.md b/INSTALL.md
index 0e9e9e1..69985c3 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -129,10 +129,6 @@ will often need to modify them in some fashion at some later point:
          cd ~/git/cstar/cassandra-dtest
          PRINT_DEBUG=true nosetests -x -s -v putget_test.py
 
-* To reuse cassandra clusters when possible, set the environment variable REUSE_CLUSTER
-
-        REUSE_CLUSTER=true nosetests -s -v cql_tests.py
-
 * Some tests will not run with vnodes enabled (you'll see a "SKIP: Test disabled for vnodes" message in that case). Use the provided runner script instead:
 
         ./run_dtests.py --vnodes false --nose-options "-x -s -v" topology_test.py:TestTopology.movement_test

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/1cc49419/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 79a65e0..ba32c3c 100644
--- a/README.md
+++ b/README.md
@@ -43,8 +43,7 @@ environment variable (that still will have precedence if given though).
 Existing tests are probably the best place to start to look at how to write
 tests.
 
-Each test spawns a new fresh cluster and tears it down after the test, unless
-`REUSE_CLUSTER` is set to true. Then some tests will share cassandra instances. If a
+Each test spawns a new fresh cluster and tears it down after the test. If a
 test fails, the logs for the node are saved in a `logs/<timestamp>` directory
 for analysis (it's not perfect but has been good enough so far, I'm open to
 better suggestions).

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/1cc49419/cqlsh_tests/cqlsh_copy_tests.py
----------------------------------------------------------------------
diff --git a/cqlsh_tests/cqlsh_copy_tests.py b/cqlsh_tests/cqlsh_copy_tests.py
index 43d33db..8501497 100644
--- a/cqlsh_tests/cqlsh_copy_tests.py
+++ b/cqlsh_tests/cqlsh_copy_tests.py
@@ -25,8 +25,7 @@ from ccmlib.common import is_win
 from cqlsh_tools import (DummyColorMap, assert_csvs_items_equal, csv_rows,
                          monkeypatch_driver, random_list, unmonkeypatch_driver,
                          write_rows_to_csv)
-from dtest import (DISABLE_VNODES, Tester, canReuseCluster, debug,
-                   freshCluster, warning, create_ks)
+from dtest import (DISABLE_VNODES, Tester, debug, warning, create_ks)
 from tools.data import rows_to_list
 from tools.decorators import since
 from tools.metadata_wrapper import (UpdatingClusterMetadataWrapper,
@@ -55,7 +54,6 @@ class UTC(datetime.tzinfo):
         return datetime.timedelta(0)
 
 
-@canReuseCluster
 class CqlshCopyTest(Tester):
     """
     Tests the COPY TO and COPY FROM features in cqlsh.
@@ -2359,23 +2357,18 @@ class CqlshCopyTest(Tester):
         new_results = list(self.session.execute("SELECT * FROM testcopyto"))
         self.assertEqual(results, new_results)
 
-    @freshCluster()
     def test_round_trip_murmur3(self):
         self._test_round_trip(nodes=3, partitioner="murmur3")
 
-    @freshCluster()
     def test_round_trip_random(self):
         self._test_round_trip(nodes=3, partitioner="random")
 
-    @freshCluster()
     def test_round_trip_order_preserving(self):
         self._test_round_trip(nodes=3, partitioner="order")
 
-    @freshCluster()
     def test_round_trip_byte_ordered(self):
         self._test_round_trip(nodes=3, partitioner="byte")
 
-    @freshCluster()
     def test_source_copy_round_trip(self):
         """
         Like test_round_trip, but uses the SOURCE command to execute the
@@ -2523,7 +2516,6 @@ class CqlshCopyTest(Tester):
 
         return ret
 
-    @freshCluster()
     def test_bulk_round_trip_default(self):
         """
         Test bulk import with default stress import (one row per operation)
@@ -2542,7 +2534,6 @@ class CqlshCopyTest(Tester):
         self._test_bulk_round_trip(nodes=3, partitioner="murmur3", num_operations=100000,
                                    copy_from_options={'PREPAREDSTATEMENTS': False})
 
-    @freshCluster()
     def test_bulk_round_trip_blogposts(self):
         """
         Test bulk import with a user profile that inserts 10 rows per operation and has a replication factor 3
@@ -2554,7 +2545,6 @@ class CqlshCopyTest(Tester):
                                    profile=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'blogposts.yaml'),
                                    stress_table='stresscql.blogposts')
 
-    @freshCluster()
     def test_bulk_round_trip_blogposts_with_max_connections(self):
         """
         Same as test_bulk_round_trip_blogposts but limit the maximum number of concurrent connections a host will
@@ -2572,7 +2562,6 @@ class CqlshCopyTest(Tester):
                                    copy_to_options={'NUMPROCESSES': 5, 'MAXATTEMPTS': 20},
                                    copy_from_options={'NUMPROCESSES': 2})
 
-    @freshCluster()
     def test_bulk_round_trip_with_timeouts(self):
         """
         Test bulk import with very short read and write timeout values, this should exercise the
@@ -2587,7 +2576,6 @@ class CqlshCopyTest(Tester):
                                    copy_from_options={'MAXINSERTERRORS': -1},
                                    skip_count_checks=True)
 
-    @freshCluster()
     def test_bulk_round_trip_with_low_ingestrate(self):
         """
         Test bulk import with default stress import (one row per operation) and a low
@@ -2598,7 +2586,6 @@ class CqlshCopyTest(Tester):
         self._test_bulk_round_trip(nodes=3, partitioner="murmur3", num_operations=10000,
                                    copy_from_options={'INGESTRATE': 1500})
 
-    @freshCluster()
     def test_bulk_round_trip_with_single_core(self):
         """
         Perform a round trip on a simulated single core machine. When determining the number of cores,
@@ -2614,7 +2601,6 @@ class CqlshCopyTest(Tester):
             for out in ret:
                 self.assertIn("Detected 1 core", out[0])
 
-    @freshCluster()
     @since('3.0.5')
     def test_bulk_round_trip_with_backoff(self):
         """
@@ -2655,7 +2641,6 @@ class CqlshCopyTest(Tester):
         debug("Using failure range: {}, {}".format(start, end))
         return start, end
 
-    @freshCluster()
     def test_copy_to_with_more_failures_than_max_attempts(self):
         """
         Test exporting rows with failure injection by setting the environment variable CQLSH_COPY_TEST_FAILURES,
@@ -2686,7 +2671,6 @@ class CqlshCopyTest(Tester):
         self.assertIn('some records might be missing', err)
         self.assertTrue(len(open(tempfile.name).readlines()) < num_records)
 
-    @freshCluster()
     def test_copy_to_with_fewer_failures_than_max_attempts(self):
         """
         Test exporting rows with failure injection by setting the environment variable CQLSH_COPY_TEST_FAILURES,
@@ -2716,7 +2700,6 @@ class CqlshCopyTest(Tester):
         self.assertNotIn('some records might be missing', err)
         self.assertEqual(num_records, len(open(tempfile.name).readlines()))
 
-    @freshCluster()
     def test_copy_to_with_child_process_crashing(self):
         """
         Test exporting rows with failure injection by setting the environment variable CQLSH_COPY_TEST_FAILURES,
@@ -2746,7 +2729,6 @@ class CqlshCopyTest(Tester):
         self.assertIn('some records might be missing', err)
         self.assertTrue(len(open(tempfile.name).readlines()) < num_records)
 
-    @freshCluster()
     def test_copy_from_with_more_failures_than_max_attempts(self):
         """
         Test importing rows with failure injection by setting the environment variable CQLSH_COPY_TEST_FAILURES,
@@ -2783,7 +2765,6 @@ class CqlshCopyTest(Tester):
         num_records_imported = rows_to_list(self.session.execute("SELECT COUNT(*) FROM {}".format(stress_table)))[0][0]
         self.assertTrue(num_records_imported < num_records)
 
-    @freshCluster()
     def test_copy_from_with_fewer_failures_than_max_attempts(self):
         """
         Test importing rows with failure injection by setting the environment variable CQLSH_COPY_TEST_FAILURES,
@@ -2823,7 +2804,6 @@ class CqlshCopyTest(Tester):
         num_records_imported = rows_to_list(self.session.execute("SELECT COUNT(*) FROM {}".format(stress_table)))[0][0]
         self.assertEquals(num_records, num_records_imported)
 
-    @freshCluster()
     def test_copy_from_with_child_process_crashing(self):
         """
         Test importing rows with failure injection by setting the environment variable CQLSH_COPY_TEST_FAILURES,
@@ -2898,7 +2878,6 @@ class CqlshCopyTest(Tester):
         self.assertLess(num_records_imported, num_records)
 
     @since('2.2.5')
-    @freshCluster()
     def test_copy_from_with_large_cql_rows(self):
         """
         Test importing CQL rows that are larger than batch_size_warn_threshold_in_kb and
@@ -2994,7 +2973,6 @@ class CqlshCopyTest(Tester):
         _test(True)
         _test(False)
 
-    @freshCluster()
     @since('2.2')
     def test_round_trip_with_authentication(self):
         """

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/1cc49419/dtest.py
----------------------------------------------------------------------
diff --git a/dtest.py b/dtest.py
index 1033c69..0fd5ec5 100644
--- a/dtest.py
+++ b/dtest.py
@@ -71,7 +71,6 @@ PRINT_DEBUG = os.environ.get('PRINT_DEBUG', '').lower() in ('yes', 'true')
 OFFHEAP_MEMTABLES = os.environ.get('OFFHEAP_MEMTABLES', '').lower() in ('yes', 'true')
 NUM_TOKENS = os.environ.get('NUM_TOKENS', '256')
 RECORD_COVERAGE = os.environ.get('RECORD_COVERAGE', '').lower() in ('yes', 'true')
-REUSE_CLUSTER = os.environ.get('REUSE_CLUSTER', '').lower() in ('yes', 'true')
 IGNORE_REQUIRE = os.environ.get('IGNORE_REQUIRE', '').lower() in ('yes', 'true')
 DATADIR_COUNT = os.environ.get('DATADIR_COUNT', '3')
 ENABLE_ACTIVE_LOG_WATCHING = os.environ.get('ENABLE_ACTIVE_LOG_WATCHING', '').lower() in ('yes', 'true')
@@ -1069,30 +1068,6 @@ class ReusableClusterTester(Tester):
         init_default_config(cls.cluster, cls.cluster_options)
 
 
-def canReuseCluster(Tester):
-    orig_init = Tester.__init__
-    # make copy of original __init__, so we can call it without recursion
-
-    def __init__(self, *args, **kwargs):
-        self._preserve_cluster = REUSE_CLUSTER
-        orig_init(self, *args, **kwargs)  # call the original __init__
-
-    Tester.__init__ = __init__  # set the class' __init__ to the new one
-    return Tester
-
-
-class freshCluster():
-
-    def __call__(self, f):
-        def wrapped(obj):
-            obj._preserve_cluster = False
-            obj.setUp()
-            f(obj)
-        wrapped.__name__ = f.__name__
-        wrapped.__doc__ = f.__doc__
-        return wrapped
-
-
 class MultiError(Exception):
     """
     Extends Exception to provide reporting multiple exceptions at once.

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/1cc49419/upgrade_tests/cql_tests.py
----------------------------------------------------------------------
diff --git a/upgrade_tests/cql_tests.py b/upgrade_tests/cql_tests.py
index d9245d2..267d2a4 100644
--- a/upgrade_tests/cql_tests.py
+++ b/upgrade_tests/cql_tests.py
@@ -18,7 +18,7 @@ from cassandra.util import sortedset
 from nose.exc import SkipTest
 from nose.tools import assert_not_in
 
-from dtest import RUN_STATIC_UPGRADE_MATRIX, debug, freshCluster
+from dtest import RUN_STATIC_UPGRADE_MATRIX, debug
 from thrift_bindings.v22.ttypes import \
     ConsistencyLevel as ThriftConsistencyLevel
 from thrift_bindings.v22.ttypes import (CfDef, Column, ColumnDef,
@@ -297,7 +297,6 @@ class TestCQL(UpgradeTester):
                 [24, 'Something something', 'Frodo Baggins'],
                 [30, 'Yet one more message', None]])
 
-    @freshCluster()
     def limit_ranges_test(self):
         """ Validate LIMIT option for 'range queries' in SELECT statements """
         cursor = self.prepare(ordered=True)
@@ -1125,7 +1124,6 @@ class TestCQL(UpgradeTester):
 
             assert_all(cursor, "SELECT * FROM users WHERE KEY='user1'", [])
 
-    @freshCluster()
     def undefined_column_handling_test(self):
         cursor = self.prepare(ordered=True)
 
@@ -1149,7 +1147,6 @@ class TestCQL(UpgradeTester):
 
             assert_all(cursor, "SELECT v2 FROM test WHERE k = 1", [[None]])
 
-    @freshCluster()
     def range_tombstones_test(self):
         """ Test deletion by 'composite prefix' (range tombstones) """
 
@@ -1654,7 +1651,6 @@ class TestCQL(UpgradeTester):
             cursor.execute("INSERT INTO test (k, c) VALUES (2, 2)")
             assert_one(cursor, "SELECT * FROM test", [2, 2, None, None])
 
-    @freshCluster()
     def only_pk_test(self):
         """
         Check table with only a PK (part of #4361)
@@ -1731,7 +1727,6 @@ class TestCQL(UpgradeTester):
             cursor.execute("INSERT INTO test (k, t) VALUES (0, '2011-02-03')")
             assert_invalid(cursor, "INSERT INTO test (k, t) VALUES (0, '2011-42-42')")
 
-    @freshCluster()
     def range_slice_test(self):
         """
         Test a regression from #1337
@@ -1756,7 +1751,6 @@ class TestCQL(UpgradeTester):
 
             assert_row_count(cursor, 'test', 2)
 
-    @freshCluster()
     def composite_index_with_pk_test(self):
 
         cursor = self.prepare(ordered=True)
@@ -1820,7 +1814,6 @@ class TestCQL(UpgradeTester):
                 assert_invalid(cursor, "SELECT content FROM blogs WHERE time1 = 1 AND time2 = 1 AND author='foo'")
                 assert_invalid(cursor, "SELECT content FROM blogs WHERE time1 = 1 AND time2 > 0 AND author='foo'")
 
-    @freshCluster()
     def limit_bugs_test(self):
         """
         Test for LIMIT bugs from #4579
@@ -1911,7 +1904,6 @@ class TestCQL(UpgradeTester):
             assert_invalid(cursor, "SELECT * FROM compositetest WHERE ctime>=12345679 AND key='key3' AND ctime<=12345680 LIMIT 3;")
             assert_invalid(cursor, "SELECT * FROM compositetest WHERE ctime=12345679  AND key='key3' AND ctime<=12345680 LIMIT 3;")
 
-    @freshCluster()
     def order_by_multikey_test(self):
         """
         Test for #4612 bug and more generally order by when multiple C* rows are queried
@@ -2343,7 +2335,6 @@ class TestCQL(UpgradeTester):
 
             assert_one(cursor, "SELECT l1, l2 FROM test WHERE k = 0", [[1, 24, 3], [4, 42, 6]])
 
-    @freshCluster()
     def composite_index_collections_test(self):
         cursor = self.prepare(ordered=True)
         cursor.execute("""
@@ -2372,7 +2363,6 @@ class TestCQL(UpgradeTester):
             query = "SELECT blog_id, content FROM blogs WHERE author='foo'"
             assert_all(cursor, query, [[1, set(['bar1', 'bar2'])], [1, set(['bar2', 'bar3'])], [2, set(['baz'])]])
 
-    @freshCluster()
     def truncate_clean_cache_test(self):
         cursor = self.prepare(ordered=True, use_cache=True)
 
@@ -3195,7 +3185,6 @@ class TestCQL(UpgradeTester):
                 assert_invalid(cursor, "DELETE FROM test2 WHERE k = 0 AND i > 0 IF EXISTS")
                 assert_invalid(cursor, "DELETE FROM test2 WHERE k = 0 AND i > 0 IF v = 'foo'")
 
-    @freshCluster()
     def range_key_ordered_test(self):
         cursor = self.prepare(ordered=True)
 
@@ -3430,7 +3419,6 @@ class TestCQL(UpgradeTester):
             cursor.execute("INSERT INTO test(k) VALUES (0)")
             assert_one(cursor, "SELECT dateOf(t) FROM test WHERE k=0", [None])
 
-    @freshCluster()
     def cas_simple_test(self):
         # cursor = self.prepare(nodes=3, rf=3)
         cursor = self.prepare()


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


[09/50] cassandra-dtest git commit: Merge pull request #1454 from pcmanus/test-13382

Posted by zz...@apache.org.
Merge pull request #1454 from pcmanus/test-13382

Add test to reproduce CASSANDRA-13382

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

Branch: refs/heads/master
Commit: 795d91c0ced1e9ef76368a53dd49de02ea2bc629
Parents: 7f29ad6 aa0c412
Author: Sylvain Lebresne <le...@gmail.com>
Authored: Tue Mar 28 14:42:31 2017 +0200
Committer: GitHub <no...@github.com>
Committed: Tue Mar 28 14:42:31 2017 +0200

----------------------------------------------------------------------
 upgrade_tests/cql_tests.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
----------------------------------------------------------------------



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


[35/50] cassandra-dtest git commit: Merge pull request #1477 from stef1927/13559

Posted by zz...@apache.org.
Merge pull request #1477 from stef1927/13559

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/ef84f767
Tree: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/tree/ef84f767
Diff: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/diff/ef84f767

Branch: refs/heads/master
Commit: ef84f7679ad64b708cb19c5294e2e670fb69df25
Parents: 6f7caba bbe136c
Author: Stefania Alborghetti <st...@datastax.com>
Authored: Fri Jun 9 07:36:35 2017 +0800
Committer: GitHub <no...@github.com>
Committed: Fri Jun 9 07:36:35 2017 +0800

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



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


[23/50] cassandra-dtest git commit: adding test for repair preview introduced in CASSANDRA-13257 (#1465)

Posted by zz...@apache.org.
adding test for repair preview introduced in CASSANDRA-13257 (#1465)

* adding test for repair preview

* review fixes


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

Branch: refs/heads/master
Commit: d5c413c41ba174276196a8b7c5f590632c5e20be
Parents: 0667de0
Author: Blake Eggleston <bd...@gmail.com>
Authored: Tue May 9 12:45:10 2017 -0700
Committer: Philip Thompson <pt...@gmail.com>
Committed: Tue May 9 15:45:10 2017 -0400

----------------------------------------------------------------------
 repair_tests/preview_repair_test.py | 85 ++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/d5c413c4/repair_tests/preview_repair_test.py
----------------------------------------------------------------------
diff --git a/repair_tests/preview_repair_test.py b/repair_tests/preview_repair_test.py
new file mode 100644
index 0000000..e888a9b
--- /dev/null
+++ b/repair_tests/preview_repair_test.py
@@ -0,0 +1,85 @@
+import time
+
+from cassandra import ConsistencyLevel
+from cassandra.query import SimpleStatement
+
+from dtest import Tester
+from tools.decorators import no_vnodes
+
+
+class PreviewRepairTest(Tester):
+
+    def assert_no_repair_history(self, session):
+        rows = session.execute("select * from system_distributed.repair_history")
+        self.assertEqual(rows.current_rows, [])
+        rows = session.execute("select * from system_distributed.parent_repair_history")
+        self.assertEqual(rows.current_rows, [])
+
+    @no_vnodes()
+    def preview_test(self):
+        """ Test that preview correctly detects out of sync data """
+        cluster = self.cluster
+        cluster.set_configuration_options(values={'hinted_handoff_enabled': False, 'commitlog_sync_period_in_ms': 500})
+        cluster.populate(3).start()
+        node1, node2, node3 = cluster.nodelist()
+
+        session = self.patient_exclusive_cql_connection(node3)
+        session.execute("CREATE KEYSPACE ks WITH REPLICATION={'class':'SimpleStrategy', 'replication_factor': 3}")
+        session.execute("CREATE TABLE ks.tbl (k INT PRIMARY KEY, v INT)")
+
+        # everything should be in sync
+        result = node1.repair(options=['ks', '--preview'])
+        self.assertIn("Previewed data was in sync", result.stdout)
+        self.assert_no_repair_history(session)
+
+        # make data inconsistent between nodes
+        stmt = SimpleStatement("INSERT INTO ks.tbl (k,v) VALUES (%s, %s)")
+        stmt.consistency_level = ConsistencyLevel.ALL
+        for i in range(10):
+            session.execute(stmt, (i, i))
+        node3.flush()
+        time.sleep(1)
+        node3.stop(gently=False)
+        stmt.consistency_level = ConsistencyLevel.QUORUM
+
+        session = self.exclusive_cql_connection(node1)
+        for i in range(10):
+            session.execute(stmt, (i + 10, i + 10))
+        node1.flush()
+        time.sleep(1)
+        node1.stop(gently=False)
+        node3.start(wait_other_notice=True, wait_for_binary_proto=True)
+        session = self.exclusive_cql_connection(node2)
+        for i in range(10):
+            session.execute(stmt, (i + 20, i + 20))
+        node1.start(wait_other_notice=True, wait_for_binary_proto=True)
+
+        # data should not be in sync for full and unrepaired previews
+        result = node1.repair(options=['ks', '--preview'])
+        self.assertIn("Total estimated streaming", result.stdout)
+        self.assertNotIn("Previewed data was in sync", result.stdout)
+
+        result = node1.repair(options=['ks', '--preview', '--full'])
+        self.assertIn("Total estimated streaming", result.stdout)
+        self.assertNotIn("Previewed data was in sync", result.stdout)
+
+        # repaired data should be in sync anyway
+        result = node1.repair(options=['ks', '--validate'])
+        self.assertIn("Repaired data is in sync", result.stdout)
+
+        self.assert_no_repair_history(session)
+
+        # repair the data...
+        node1.repair(options=['ks'])
+        for node in cluster.nodelist():
+            node.nodetool('compact ks tbl')
+
+        # ...and everything should be in sync
+        result = node1.repair(options=['ks', '--preview'])
+        self.assertIn("Previewed data was in sync", result.stdout)
+
+        result = node1.repair(options=['ks', '--preview', '--full'])
+        self.assertIn("Previewed data was in sync", result.stdout)
+
+        result = node1.repair(options=['ks', '--validate'])
+        self.assertIn("Repaired data is in sync", result.stdout)


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


[18/50] cassandra-dtest git commit: Fix timeouts at TestAuthUpgrade.upgrade_to_22_test and TestAuthUpgrade.upgrade_to_30_test

Posted by zz...@apache.org.
Fix timeouts at TestAuthUpgrade.upgrade_to_22_test and TestAuthUpgrade.upgrade_to_30_test


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

Branch: refs/heads/master
Commit: 704c7b062d263c3b646bbb7d7cbd967279d8a31c
Parents: 864f956
Author: adelapena <a....@gmail.com>
Authored: Mon Apr 3 13:20:23 2017 +0100
Committer: Philip Thompson <pt...@gmail.com>
Committed: Thu Apr 6 11:54:53 2017 -0400

----------------------------------------------------------------------
 tools/assertions.py           |  5 +++--
 upgrade_internal_auth_test.py | 12 +++++++-----
 2 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/704c7b06/tools/assertions.py
----------------------------------------------------------------------
diff --git a/tools/assertions.py b/tools/assertions.py
index b7e5d09..2e88067 100644
--- a/tools/assertions.py
+++ b/tools/assertions.py
@@ -147,7 +147,7 @@ def assert_none(session, query, cl=None):
     assert list_res == [], "Expected nothing from {}, but got {}".format(query, list_res)
 
 
-def assert_all(session, query, expected, cl=None, ignore_order=False):
+def assert_all(session, query, expected, cl=None, ignore_order=False, timeout=None):
     """
     Assert query returns all expected items optionally in the correct order
     @param session Session in use
@@ -155,13 +155,14 @@ def assert_all(session, query, expected, cl=None, ignore_order=False):
     @param expected Expected results from query
     @param cl Optional Consistency Level setting. Default ONE
     @param ignore_order Optional boolean flag determining whether response is ordered
+    @param timeout Optional query timeout, in seconds
 
     Examples:
     assert_all(session, "LIST USERS", [['aleksey', False], ['cassandra', True]])
     assert_all(self.session1, "SELECT * FROM ttl_table;", [[1, 42, 1, 1]])
     """
     simple_query = SimpleStatement(query, consistency_level=cl)
-    res = session.execute(simple_query)
+    res = session.execute(simple_query) if timeout is None else session.execute(simple_query, timeout=timeout)
     list_res = _rows_to_list(res)
     if ignore_order:
         expected = sorted(expected)

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/704c7b06/upgrade_internal_auth_test.py
----------------------------------------------------------------------
diff --git a/upgrade_internal_auth_test.py b/upgrade_internal_auth_test.py
index ed34452..2c5681d 100644
--- a/upgrade_internal_auth_test.py
+++ b/upgrade_internal_auth_test.py
@@ -145,9 +145,9 @@ class TestAuthUpgrade(Tester):
 
         # we should now be able to drop the old auth tables
         session = self.patient_cql_connection(node1, user='cassandra', password='cassandra')
-        session.execute('DROP TABLE system_auth.users')
-        session.execute('DROP TABLE system_auth.credentials')
-        session.execute('DROP TABLE system_auth.permissions')
+        session.execute('DROP TABLE system_auth.users', timeout=60)
+        session.execute('DROP TABLE system_auth.credentials', timeout=60)
+        session.execute('DROP TABLE system_auth.permissions', timeout=60)
         # and we should still be able to authenticate and check authorization
         self.check_permissions(node1, True)
         debug('Test completed successfully')
@@ -163,12 +163,14 @@ class TestAuthUpgrade(Tester):
             assert_all(klaus,
                        'LIST ALL PERMISSIONS',
                        [['michael', '<table ks.cf1>', 'MODIFY'],
-                        ['michael', '<table ks.cf2>', 'SELECT']])
+                        ['michael', '<table ks.cf2>', 'SELECT']],
+                       timeout=60)
         else:
             assert_all(klaus,
                        'LIST ALL PERMISSIONS',
                        [['michael', 'michael', '<table ks.cf1>', 'MODIFY'],
-                        ['michael', 'michael', '<table ks.cf2>', 'SELECT']])
+                        ['michael', 'michael', '<table ks.cf2>', 'SELECT']],
+                       timeout=60)
 
         klaus.cluster.shutdown()
 


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


[49/50] cassandra-dtest git commit: Add a test for CASSANDRA-13346 (#1467)

Posted by zz...@apache.org.
Add a test for CASSANDRA-13346 (#1467)

* Add a test for CASSANDRA-13346; Optionally make reading JMX attributes verbose or not

* Compliance with Pep8


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

Branch: refs/heads/master
Commit: 6f4e41e04c3d48f1dbbcd0fc636e39e8d114a6be
Parents: 058b952
Author: juiceblender <le...@gmail.com>
Authored: Fri Jul 7 18:39:00 2017 +1000
Committer: Philip Thompson <pt...@gmail.com>
Committed: Fri Jul 7 10:39:00 2017 +0200

----------------------------------------------------------------------
 jmx_test.py       | 93 +++++++++++++++++++++++++++++++++++++++++++++-----
 tools/jmxutils.py | 12 +++----
 2 files changed, 90 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/6f4e41e0/jmx_test.py
----------------------------------------------------------------------
diff --git a/jmx_test.py b/jmx_test.py
index 7df84ac..16c1ece 100644
--- a/jmx_test.py
+++ b/jmx_test.py
@@ -13,7 +13,6 @@ from tools.misc import generate_ssl_stores
 
 
 class TestJMX(Tester):
-
     def netstats_test(self):
         """
         Check functioning of nodetool netstats, especially with restarts.
@@ -48,7 +47,8 @@ class TestJMX(Tester):
                 if not isinstance(e, ToolError):
                     raise
                 else:
-                    self.assertRegexpMatches(str(e), "ConnectException: 'Connection refused( \(Connection refused\))?'.")
+                    self.assertRegexpMatches(str(e),
+                                             "ConnectException: 'Connection refused( \(Connection refused\))?'.")
 
         self.assertTrue(running, msg='node1 never started')
 
@@ -69,9 +69,12 @@ class TestJMX(Tester):
         debug('Version {} typeName {}'.format(version, typeName))
 
         # TODO the keyspace and table name are capitalized in 2.0
-        memtable_size = make_mbean('metrics', type=typeName, keyspace='keyspace1', scope='standard1', name='AllMemtablesHeapSize')
-        disk_size = make_mbean('metrics', type=typeName, keyspace='keyspace1', scope='standard1', name='LiveDiskSpaceUsed')
-        sstable_count = make_mbean('metrics', type=typeName, keyspace='keyspace1', scope='standard1', name='LiveSSTableCount')
+        memtable_size = make_mbean('metrics', type=typeName, keyspace='keyspace1', scope='standard1',
+                                   name='AllMemtablesHeapSize')
+        disk_size = make_mbean('metrics', type=typeName, keyspace='keyspace1', scope='standard1',
+                               name='LiveDiskSpaceUsed')
+        sstable_count = make_mbean('metrics', type=typeName, keyspace='keyspace1', scope='standard1',
+                                   name='LiveSSTableCount')
 
         with JolokiaAgent(node1) as jmx:
             mem_size = jmx.read_attribute(memtable_size, "Value")
@@ -88,6 +91,76 @@ class TestJMX(Tester):
             sstables = jmx.read_attribute(sstable_count, "Value")
             self.assertGreaterEqual(int(sstables), 1)
 
+    @since('3.0')
+    def mv_metric_mbeans_release_test(self):
+        """
+        Test that the right mbeans are created and released when creating mvs
+        """
+        cluster = self.cluster
+        cluster.populate(1)
+        node = cluster.nodelist()[0]
+        remove_perf_disable_shared_mem(node)
+        cluster.start(wait_for_binary_proto=True)
+
+        node.run_cqlsh(cmds="""
+            CREATE KEYSPACE mvtest WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor': 1 };
+            CREATE TABLE mvtest.testtable (
+                foo int,
+                bar text,
+                baz text,
+                PRIMARY KEY (foo, bar)
+            );
+
+            CREATE MATERIALIZED VIEW mvtest.testmv AS
+                SELECT foo, bar, baz FROM mvtest.testtable WHERE
+                foo IS NOT NULL AND bar IS NOT NULL AND baz IS NOT NULL
+            PRIMARY KEY (foo, bar, baz);""")
+
+        table_memtable_size = make_mbean('metrics', type='Table', keyspace='mvtest', scope='testtable',
+                                         name='AllMemtablesHeapSize')
+        table_view_read_time = make_mbean('metrics', type='Table', keyspace='mvtest', scope='testtable',
+                                          name='ViewReadTime')
+        table_view_lock_time = make_mbean('metrics', type='Table', keyspace='mvtest', scope='testtable',
+                                          name='ViewLockAcquireTime')
+        mv_memtable_size = make_mbean('metrics', type='Table', keyspace='mvtest', scope='testmv',
+                                      name='AllMemtablesHeapSize')
+        mv_view_read_time = make_mbean('metrics', type='Table', keyspace='mvtest', scope='testmv',
+                                       name='ViewReadTime')
+        mv_view_lock_time = make_mbean('metrics', type='Table', keyspace='mvtest', scope='testmv',
+                                       name='ViewLockAcquireTime')
+
+        missing_metric_message = "Table metric %s should have been registered after creating table %s" \
+                                 "but wasn't!"
+
+        with JolokiaAgent(node) as jmx:
+            self.assertIsNotNone(jmx.read_attribute(table_memtable_size, "Value"),
+                                 missing_metric_message.format("AllMemtablesHeapSize", "testtable"))
+            self.assertIsNotNone(jmx.read_attribute(table_view_read_time, "Count"),
+                                 missing_metric_message.format("ViewReadTime", "testtable"))
+            self.assertIsNotNone(jmx.read_attribute(table_view_lock_time, "Count"),
+                                 missing_metric_message.format("ViewLockAcquireTime", "testtable"))
+            self.assertIsNotNone(jmx.read_attribute(mv_memtable_size, "Value"),
+                                 missing_metric_message.format("AllMemtablesHeapSize", "testmv"))
+            self.assertRaisesRegexp(Exception, ".*InstanceNotFoundException.*", jmx.read_attribute,
+                                    mbean=mv_view_read_time, attribute="Count", verbose=False)
+            self.assertRaisesRegexp(Exception, ".*InstanceNotFoundException.*", jmx.read_attribute,
+                                    mbean=mv_view_lock_time, attribute="Count", verbose=False)
+
+        node.run_cqlsh(cmds="DROP KEYSPACE mvtest;")
+        with JolokiaAgent(node) as jmx:
+            self.assertRaisesRegexp(Exception, ".*InstanceNotFoundException.*", jmx.read_attribute,
+                                    mbean=table_memtable_size, attribute="Value", verbose=False)
+            self.assertRaisesRegexp(Exception, ".*InstanceNotFoundException.*", jmx.read_attribute,
+                                    mbean=table_view_lock_time, attribute="Count", verbose=False)
+            self.assertRaisesRegexp(Exception, ".*InstanceNotFoundException.*", jmx.read_attribute,
+                                    mbean=table_view_read_time, attribute="Count", verbose=False)
+            self.assertRaisesRegexp(Exception, ".*InstanceNotFoundException.*", jmx.read_attribute,
+                                    mbean=mv_memtable_size, attribute="Value", verbose=False)
+            self.assertRaisesRegexp(Exception, ".*InstanceNotFoundException.*", jmx.read_attribute,
+                                    mbean=mv_view_lock_time, attribute="Count", verbose=False)
+            self.assertRaisesRegexp(Exception, ".*InstanceNotFoundException.*", jmx.read_attribute,
+                                    mbean=mv_view_read_time, attribute="Count", verbose=False)
+
     def test_compactionstats(self):
         """
         @jira_ticket CASSANDRA-10504
@@ -147,7 +220,8 @@ class TestJMX(Tester):
             start = time.time()
             max_query_timeout = 600
             debug("Waiting for compaction to finish:")
-            while (len(jmx.read_attribute(compaction_manager, 'CompactionSummary')) > 0) and (time.time() - start < max_query_timeout):
+            while (len(jmx.read_attribute(compaction_manager, 'CompactionSummary')) > 0) and (
+                    time.time() - start < max_query_timeout):
                 debug(jmx.read_attribute(compaction_manager, 'CompactionSummary'))
                 time.sleep(2)
 
@@ -205,7 +279,6 @@ class TestJMX(Tester):
 
 @since('3.9')
 class TestJMXSSL(Tester):
-
     keystore_password = 'cassandra'
     truststore_password = 'cassandra'
 
@@ -247,8 +320,10 @@ class TestJMXSSL(Tester):
                           .format(ts=self.truststore(), ts_pwd=self.truststore_password))
 
         # when both truststore and a keystore containing the client key are supplied, connection should succeed
-        node.nodetool("info --ssl -Djavax.net.ssl.trustStore={ts} -Djavax.net.ssl.trustStorePassword={ts_pwd} -Djavax.net.ssl.keyStore={ks} -Djavax.net.ssl.keyStorePassword={ks_pwd}"
-                      .format(ts=self.truststore(), ts_pwd=self.truststore_password, ks=self.keystore(), ks_pwd=self.keystore_password))
+        node.nodetool(
+            "info --ssl -Djavax.net.ssl.trustStore={ts} -Djavax.net.ssl.trustStorePassword={ts_pwd} -Djavax.net.ssl.keyStore={ks} -Djavax.net.ssl.keyStorePassword={ks_pwd}"
+            .format(ts=self.truststore(), ts_pwd=self.truststore_password, ks=self.keystore(),
+                    ks_pwd=self.keystore_password))
 
     def assert_insecure_connection_rejected(self, node):
         """

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/6f4e41e0/tools/jmxutils.py
----------------------------------------------------------------------
diff --git a/tools/jmxutils.py b/tools/jmxutils.py
index c910dbf..1f41626 100644
--- a/tools/jmxutils.py
+++ b/tools/jmxutils.py
@@ -225,7 +225,7 @@ class JolokiaAgent(object):
             print "Output was: %s" % (exc.output,)
             raise
 
-    def _query(self, body):
+    def _query(self, body, verbose=True):
         request_data = json.dumps(body)
         url = 'http://%s:8778/jolokia/' % (self.node.network_interfaces['binary'][0],)
         response = urlopen(url, data=request_data, timeout=10.0)
@@ -236,14 +236,14 @@ class JolokiaAgent(object):
         response = json.loads(raw_response)
         if response['status'] != 200:
             stacktrace = response.get('stacktrace')
-            if stacktrace:
+            if stacktrace and verbose:
                 print "Stacktrace from Jolokia error follows:"
                 for line in stacktrace.splitlines():
                     print line
             raise Exception("Jolokia agent returned non-200 status: %s" % (response,))
         return response
 
-    def read_attribute(self, mbean, attribute, path=None):
+    def read_attribute(self, mbean, attribute, path=None, verbose=True):
         """
         Reads a single JMX attribute.
 
@@ -260,10 +260,10 @@ class JolokiaAgent(object):
                 'attribute': attribute}
         if path:
             body['path'] = path
-        response = self._query(body)
+        response = self._query(body, verbose=verbose)
         return response['value']
 
-    def write_attribute(self, mbean, attribute, value, path=None):
+    def write_attribute(self, mbean, attribute, value, path=None, verbose=True):
         """
         Writes a values to a single JMX attribute.
 
@@ -284,7 +284,7 @@ class JolokiaAgent(object):
                 'value': value}
         if path:
             body['path'] = path
-        self._query(body)
+        self._query(body, verbose=verbose)
 
     def execute_method(self, mbean, operation, arguments=None):
         """


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


[31/50] cassandra-dtest git commit: add test to confirm that hostname validation is working

Posted by zz...@apache.org.
add test to confirm that hostname validation is working


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

Branch: refs/heads/master
Commit: bea71d8fd2e02777bd5c03234489ae9e0efe177e
Parents: 538d658
Author: Jason Brown <ja...@gmail.com>
Authored: Thu May 25 14:59:37 2017 -0700
Committer: Philip Thompson <pt...@gmail.com>
Committed: Tue May 30 14:18:13 2017 +0200

----------------------------------------------------------------------
 sslnodetonode_test.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/bea71d8f/sslnodetonode_test.py
----------------------------------------------------------------------
diff --git a/sslnodetonode_test.py b/sslnodetonode_test.py
index c4a9184..a11a3f4 100644
--- a/sslnodetonode_test.py
+++ b/sslnodetonode_test.py
@@ -26,6 +26,18 @@ class TestNodeToNodeSSLEncryption(Tester):
         self.cluster.start()
         self.cql_connection(self.node1)
 
+    def ssl_correct_hostname_with_validation_test(self):
+        """Should be able to start with valid ssl options"""
+
+        credNode1 = sslkeygen.generate_credentials("127.0.0.1")
+        credNode2 = sslkeygen.generate_credentials("127.0.0.2", credNode1.cakeystore, credNode1.cacert)
+
+        self.setup_nodes(credNode1, credNode2, endpointVerification=True)
+        self.allow_log_errors = False
+        self.cluster.start()
+        time.sleep(2)
+        self.cql_connection(self.node1)
+
     def ssl_wrong_hostname_no_validation_test(self):
         """Should be able to start with valid ssl options"""
 


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


[21/50] cassandra-dtest git commit: Create test for restoring a snapshot with dropped columns (CASSANDRA-13276)

Posted by zz...@apache.org.
Create test for restoring a snapshot with dropped columns (CASSANDRA-13276)




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

Branch: refs/heads/master
Commit: e6b47064237ce4d9dc10313995fba34cb9cdefb7
Parents: 0692e2b
Author: Andrés de la Peña <ad...@users.noreply.github.com>
Authored: Tue Apr 25 20:38:53 2017 +0100
Committer: GitHub <no...@github.com>
Committed: Tue Apr 25 20:38:53 2017 +0100

----------------------------------------------------------------------
 snapshot_test.py | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/e6b47064/snapshot_test.py
----------------------------------------------------------------------
diff --git a/snapshot_test.py b/snapshot_test.py
index ba184ee..7169a7c 100644
--- a/snapshot_test.py
+++ b/snapshot_test.py
@@ -9,6 +9,7 @@ from cassandra.concurrent import execute_concurrent_with_args
 
 from dtest import (Tester, cleanup_cluster, create_ccm_cluster, create_ks,
                    debug, get_test_path)
+from tools.assertions import assert_one
 from tools.files import replace_in_file, safe_mkdtemp
 from tools.hacks import advance_to_next_cl_segment
 from tools.misc import ImmutableMapping
@@ -70,6 +71,13 @@ class SnapshotTester(Tester):
                     raise Exception("sstableloader command '%s' failed; exit status: %d'; stdout: %s; stderr: %s" %
                                     (" ".join(args), exit_status, stdout, stderr))
 
+    def restore_snapshot_schema(self, snapshot_dir, node, ks, cf):
+        debug("Restoring snapshot schema....")
+        for x in xrange(0, self.cluster.data_dir_count):
+            schema_path = os.path.join(snapshot_dir, str(x), ks, cf, 'schema.cql')
+            if os.path.exists(schema_path):
+                node.run_cqlsh(cmds="SOURCE '%s'" % schema_path)
+
 
 class TestSnapshot(SnapshotTester):
 
@@ -106,6 +114,41 @@ class TestSnapshot(SnapshotTester):
 
         self.assertEqual(rows[0][0], 100)
 
+    def test_snapshot_and_restore_dropping_a_column(self):
+        """
+        @jira_ticket CASSANDRA-13276
+
+        Can't load snapshots of tables with dropped columns.
+        """
+        cluster = self.cluster
+        cluster.populate(1).start()
+        node1, = cluster.nodelist()
+        session = self.patient_cql_connection(node1)
+
+        # Create schema and insert some data
+        create_ks(session, 'ks', 1)
+        session.execute("CREATE TABLE ks.cf (k int PRIMARY KEY, a text, b text)")
+        session.execute("INSERT INTO ks.cf (k, a, b) VALUES (1, 'a', 'b')")
+        assert_one(session, "SELECT * FROM ks.cf", [1, "a", "b"])
+
+        # Drop a column
+        session.execute("ALTER TABLE ks.cf DROP b")
+        assert_one(session, "SELECT * FROM ks.cf", [1, "a"])
+
+        # Take a snapshot and drop the table
+        snapshot_dir = self.make_snapshot(node1, 'ks', 'cf', 'basic')
+        session.execute("DROP TABLE ks.cf")
+
+        # Restore schema and data from snapshot
+        self.restore_snapshot_schema(snapshot_dir, node1, 'ks', 'cf')
+        self.restore_snapshot(snapshot_dir, node1, 'ks', 'cf')
+        node1.nodetool('refresh ks cf')
+        assert_one(session, "SELECT * FROM ks.cf", [1, "a"])
+
+        # Clean up
+        debug("removing snapshot_dir: " + snapshot_dir)
+        shutil.rmtree(snapshot_dir)
+
 
 class TestArchiveCommitlog(SnapshotTester):
     cluster_options = ImmutableMapping({'commitlog_segment_size_in_mb': 1})


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


[34/50] cassandra-dtest git commit: Test for CASSANDRA-13559

Posted by zz...@apache.org.
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 <st...@datastax.com>
Authored: Thu Jun 1 11:03:54 2017 +0800
Committer: Stefania Alborghetti <st...@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


[22/50] cassandra-dtest git commit: CASSANDRA-13483: fixed test failure in snapshot_test.TestSnapshot.test_snapshot_and_restore_dropping_a_column

Posted by zz...@apache.org.
CASSANDRA-13483: fixed test failure in snapshot_test.TestSnapshot.test_snapshot_and_restore_dropping_a_column


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

Branch: refs/heads/master
Commit: 0667de025dd4e85dbae1b30db4a2e189c46ff47f
Parents: e6b4706
Author: Zhao Yang <zh...@gmail.com>
Authored: Mon May 1 00:34:58 2017 +0800
Committer: Philip Thompson <pt...@gmail.com>
Committed: Mon May 1 20:02:40 2017 -0400

----------------------------------------------------------------------
 snapshot_test.py | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/0667de02/snapshot_test.py
----------------------------------------------------------------------
diff --git a/snapshot_test.py b/snapshot_test.py
index 7169a7c..563af81 100644
--- a/snapshot_test.py
+++ b/snapshot_test.py
@@ -13,6 +13,7 @@ from tools.assertions import assert_one
 from tools.files import replace_in_file, safe_mkdtemp
 from tools.hacks import advance_to_next_cl_segment
 from tools.misc import ImmutableMapping
+from tools.decorators import since
 
 
 class SnapshotTester(Tester):
@@ -114,6 +115,7 @@ class TestSnapshot(SnapshotTester):
 
         self.assertEqual(rows[0][0], 100)
 
+    @since('3.11')
     def test_snapshot_and_restore_dropping_a_column(self):
         """
         @jira_ticket CASSANDRA-13276


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


[07/50] cassandra-dtest git commit: Add repair test for CASSANDRA-13153

Posted by zz...@apache.org.
Add repair test for CASSANDRA-13153


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

Branch: refs/heads/master
Commit: 7f29ad6885137d016fafa76ffabe14b699578668
Parents: cf21631
Author: Stefan Podkowinski <s....@gmail.com>
Authored: Wed Feb 22 13:24:32 2017 +0100
Committer: Philip Thompson <pt...@gmail.com>
Committed: Tue Mar 21 17:03:30 2017 -0400

----------------------------------------------------------------------
 repair_tests/repair_test.py | 56 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/7f29ad68/repair_tests/repair_test.py
----------------------------------------------------------------------
diff --git a/repair_tests/repair_test.py b/repair_tests/repair_test.py
index ff0ccf1..5148b00 100644
--- a/repair_tests/repair_test.py
+++ b/repair_tests/repair_test.py
@@ -1,5 +1,6 @@
 import threading
 import time
+import re
 from collections import namedtuple
 from threading import Thread
 from unittest import skip, skipIf
@@ -262,6 +263,61 @@ class TestRepair(BaseRepairTest):
         for node in cluster.nodelist():
             self.assertFalse(node.grep_log("Starting anticompaction"))
 
+    def _get_repaired_data(self, node, keyspace):
+        """
+        Based on incremental_repair_test.py:TestIncRepair implementation.
+        """
+        _sstable_name = re.compile('SSTable: (.+)')
+        _repaired_at = re.compile('Repaired at: (\d+)')
+        _sstable_data = namedtuple('_sstabledata', ('name', 'repaired'))
+
+        out = node.run_sstablemetadata(keyspace=keyspace).stdout
+
+        def matches(pattern):
+            return filter(None, [pattern.match(l) for l in out.split('\n')])
+
+        names = [m.group(1) for m in matches(_sstable_name)]
+        repaired_times = [int(m.group(1)) for m in matches(_repaired_at)]
+
+        self.assertTrue(names)
+        self.assertTrue(repaired_times)
+        return [_sstable_data(*a) for a in zip(names, repaired_times)]
+
+    @since('2.2.10', '4')
+    def no_anticompaction_of_already_repaired_test(self):
+        """
+        * Launch three node cluster and stress with RF2
+        * Do incremental repair to have all sstables flagged as repaired
+        * Stop node2, stress, start again and run full -pr repair
+        * Verify that none of the already repaired sstables have been anti-compacted again
+        @jira_ticket CASSANDRA-13153
+        """
+
+        cluster = self.cluster
+        debug("Starting cluster..")
+        cluster.populate(3).start(wait_for_binary_proto=True)
+        node1, node2, node3 = cluster.nodelist()
+        # we use RF to make sure to cover only a set of sub-ranges when doing -full -pr
+        node1.stress(stress_options=['write', 'n=50K', 'no-warmup', 'cl=ONE', '-schema', 'replication(factor=2)', '-rate', 'threads=50'])
+        # disable compaction to make sure that we won't create any new sstables with repairedAt 0
+        node1.nodetool('disableautocompaction keyspace1 standard1')
+        # Do incremental repair of all ranges. All sstables are expected for have repairedAt set afterwards.
+        node1.nodetool("repair keyspace1 standard1")
+        meta = self._get_repaired_data(node1, 'keyspace1')
+        repaired = set([m for m in meta if m.repaired > 0])
+        self.assertEquals(len(repaired), len(meta))
+
+        # stop node2, stress and start full repair to find out how synced ranges affect repairedAt values
+        node2.stop(wait_other_notice=True)
+        node1.stress(stress_options=['write', 'n=40K', 'no-warmup', 'cl=ONE', '-rate', 'threads=50'])
+        node2.start(wait_for_binary_proto=True, wait_other_notice=True)
+        node1.nodetool("repair -full -pr keyspace1 standard1")
+
+        meta = self._get_repaired_data(node1, 'keyspace1')
+        repairedAfterFull = set([m for m in meta if m.repaired > 0])
+        # already repaired sstables must remain untouched
+        self.assertEquals(repaired.intersection(repairedAfterFull), repaired)
+
     @since('2.2.1', '4')
     def anticompaction_after_normal_repair_test(self):
         """


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


[44/50] cassandra-dtest git commit: CASSANDRA-10130 (#1486)

Posted by zz...@apache.org.
CASSANDRA-10130 (#1486)

* Add test case for CASSANDRA-10130

* Address comments by @sbtourist

* Add more tests for index status management

* Ad missed `@staticmethod` annotation

* Add @since annotations for 4.0

* Update failing index build failures

* Fix code style removing trailing whitespaces and blank lines with whitespaces


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

Branch: refs/heads/master
Commit: 50e1e7b13a1eef3e9347aee7806dc40569ab17ad
Parents: 6847bc1
Author: Andrés de la Peña <ad...@users.noreply.github.com>
Authored: Mon Jun 26 13:18:55 2017 +0100
Committer: Philip Thompson <pt...@gmail.com>
Committed: Mon Jun 26 14:18:55 2017 +0200

----------------------------------------------------------------------
 byteman/index_build_failure.btm    |  13 +++
 secondary_indexes_test.py          | 174 +++++++++++++++++++++++++++++---
 sstable_generation_loading_test.py | 122 +++++++++++++++++-----
 3 files changed, 271 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/50e1e7b1/byteman/index_build_failure.btm
----------------------------------------------------------------------
diff --git a/byteman/index_build_failure.btm b/byteman/index_build_failure.btm
new file mode 100644
index 0000000..8f5183d
--- /dev/null
+++ b/byteman/index_build_failure.btm
@@ -0,0 +1,13 @@
+#
+# Sleep 5s during index update
+#
+RULE fail during index building
+CLASS org.apache.cassandra.db.compaction.CompactionManager
+METHOD submitIndexBuild
+AT ENTRY
+# set flag to only run this rule once.
+IF NOT flagged("done")
+DO
+   flag("done");
+   throw new java.lang.RuntimeException("Index building failure")
+ENDRULE

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/50e1e7b1/secondary_indexes_test.py
----------------------------------------------------------------------
diff --git a/secondary_indexes_test.py b/secondary_indexes_test.py
index b73e94d..1edd30e 100644
--- a/secondary_indexes_test.py
+++ b/secondary_indexes_test.py
@@ -13,7 +13,7 @@ from cassandra.query import BatchStatement, SimpleStatement
 
 from dtest import (DISABLE_VNODES, OFFHEAP_MEMTABLES, DtestTimeoutError,
                    Tester, debug, CASSANDRA_VERSION_FROM_BUILD, create_ks, create_cf)
-from tools.assertions import assert_bootstrap_state, assert_invalid, assert_one, assert_row_count
+from tools.assertions import assert_bootstrap_state, assert_invalid, assert_none, assert_one, assert_row_count
 from tools.data import index_is_built, rows_to_list
 from tools.decorators import since
 from tools.misc import new_node
@@ -21,6 +21,16 @@ from tools.misc import new_node
 
 class TestSecondaryIndexes(Tester):
 
+    @staticmethod
+    def _index_sstables_files(node, keyspace, table, index):
+        files = []
+        for data_dir in node.data_directories():
+            data_dir = os.path.join(data_dir, keyspace)
+            base_tbl_dir = os.path.join(data_dir, [s for s in os.listdir(data_dir) if s.startswith(table)][0])
+            index_sstables_dir = os.path.join(base_tbl_dir, '.' + index)
+            files.extend(os.listdir(index_sstables_dir))
+        return set(files)
+
     def data_created_before_index_not_returned_in_where_query_test(self):
         """
         @jira_ticket CASSANDRA-3367
@@ -307,14 +317,7 @@ class TestSecondaryIndexes(Tester):
 
         stmt = session.prepare('select * from standard1 where "C0" = ?')
         self.assertEqual(1, len(list(session.execute(stmt, [lookup_value]))))
-        before_files = []
-        index_sstables_dirs = []
-        for data_dir in node1.data_directories():
-            data_dir = os.path.join(data_dir, 'keyspace1')
-            base_tbl_dir = os.path.join(data_dir, [s for s in os.listdir(data_dir) if s.startswith("standard1")][0])
-            index_sstables_dir = os.path.join(base_tbl_dir, '.ix_c0')
-            before_files.extend(os.listdir(index_sstables_dir))
-            index_sstables_dirs.append(index_sstables_dir)
+        before_files = self._index_sstables_files(node1, 'keyspace1', 'standard1', 'ix_c0')
 
         node1.nodetool("rebuild_index keyspace1 standard1 ix_c0")
         start = time.time()
@@ -326,15 +329,160 @@ class TestSecondaryIndexes(Tester):
         else:
             raise DtestTimeoutError()
 
-        after_files = []
-        for index_sstables_dir in index_sstables_dirs:
-            after_files.extend(os.listdir(index_sstables_dir))
-        self.assertNotEqual(set(before_files), set(after_files))
+        after_files = self._index_sstables_files(node1, 'keyspace1', 'standard1', 'ix_c0')
+        self.assertNotEqual(before_files, after_files)
         self.assertEqual(1, len(list(session.execute(stmt, [lookup_value]))))
 
         # verify that only the expected row is present in the build indexes table
         self.assertEqual(1, len(list(session.execute("""SELECT * FROM system."IndexInfo";"""))))
 
+    @since('4.0')
+    def test_failing_manual_rebuild_index(self):
+        """
+        @jira_ticket CASSANDRA-10130
+
+        Tests the management of index status during manual index rebuilding failures.
+        """
+
+        cluster = self.cluster
+        cluster.populate(1, install_byteman=True).start(wait_for_binary_proto=True)
+        node = cluster.nodelist()[0]
+
+        session = self.patient_cql_connection(node)
+        create_ks(session, 'k', 1)
+        session.execute("CREATE TABLE k.t (k int PRIMARY KEY, v int)")
+        session.execute("CREATE INDEX idx ON k.t(v)")
+        session.execute("INSERT INTO k.t(k, v) VALUES (0, 1)")
+        session.execute("INSERT INTO k.t(k, v) VALUES (2, 3)")
+
+        # Verify that the index is marked as built and it can answer queries
+        assert_one(session, """SELECT * FROM system."IndexInfo" WHERE table_name='k'""", ['k', 'idx'])
+        assert_one(session, "SELECT * FROM k.t WHERE v = 1", [0, 1])
+
+        # Simulate a failing index rebuild
+        before_files = self._index_sstables_files(node, 'k', 't', 'idx')
+        node.byteman_submit(['./byteman/index_build_failure.btm'])
+        with self.assertRaises(Exception):
+            node.nodetool("rebuild_index k t idx")
+        after_files = self._index_sstables_files(node, 'k', 't', 'idx')
+
+        # Verify that the index is not rebuilt, not marked as built, and it still can answer queries
+        self.assertEqual(before_files, after_files)
+        assert_none(session, """SELECT * FROM system."IndexInfo" WHERE table_name='k'""")
+        assert_one(session, "SELECT * FROM k.t WHERE v = 1", [0, 1])
+
+        # Restart the node to trigger the scheduled index rebuild
+        before_files = after_files
+        node.nodetool('drain')
+        node.stop()
+        cluster.start()
+        session = self.patient_cql_connection(node)
+        session.execute("USE k")
+        after_files = self._index_sstables_files(node, 'k', 't', 'idx')
+
+        # Verify that, the index is rebuilt, marked as built, and it can answer queries
+        self.assertNotEqual(before_files, after_files)
+        assert_one(session, """SELECT * FROM system."IndexInfo" WHERE table_name='k'""", ['k', 'idx'])
+        assert_one(session, "SELECT * FROM k.t WHERE v = 1", [0, 1])
+
+        # Simulate another failing index rebuild
+        before_files = self._index_sstables_files(node, 'k', 't', 'idx')
+        node.byteman_submit(['./byteman/index_build_failure.btm'])
+        with self.assertRaises(Exception):
+            node.nodetool("rebuild_index k t idx")
+        after_files = self._index_sstables_files(node, 'k', 't', 'idx')
+
+        # Verify that the index is not rebuilt, not marked as built, and it still can answer queries
+        self.assertEqual(before_files, after_files)
+        assert_none(session, """SELECT * FROM system."IndexInfo" WHERE table_name='k'""")
+        assert_one(session, "SELECT * FROM k.t WHERE v = 1", [0, 1])
+
+        # Successfully rebuild the index
+        before_files = after_files
+        node.nodetool("rebuild_index k t idx")
+        cluster.wait_for_compactions()
+        after_files = self._index_sstables_files(node, 'k', 't', 'idx')
+
+        # Verify that the index is rebuilt, marked as built, and it can answer queries
+        self.assertNotEqual(before_files, after_files)
+        assert_one(session, """SELECT * FROM system."IndexInfo" WHERE table_name='k'""", ['k', 'idx'])
+        assert_one(session, "SELECT * FROM k.t WHERE v = 1", [0, 1])
+
+    @since('4.0')
+    def test_drop_index_while_building(self):
+        """
+        asserts that indexes deleted before they have been completely build are invalidated and not built after restart
+        """
+        cluster = self.cluster
+        cluster.populate(1).start()
+        node = cluster.nodelist()[0]
+        session = self.patient_cql_connection(node)
+
+        # Create some thousands of rows to guarantee a long index building
+        node.stress(['write', 'n=50K', 'no-warmup'])
+        session.execute("USE keyspace1")
+
+        # Create an index and immediately drop it, without waiting for index building
+        session.execute('CREATE INDEX idx ON standard1("C0")')
+        session.execute('DROP INDEX idx')
+        cluster.wait_for_compactions()
+
+        # Check that the index is not marked as built nor queryable
+        assert_none(session, """SELECT * FROM system."IndexInfo" WHERE table_name='keyspace1'""")
+        assert_invalid(session,
+                       'SELECT * FROM standard1 WHERE "C0" = 0x00',
+                       'Cannot execute this query as it might involve data filtering')
+
+        # Restart the node to trigger any eventual unexpected index rebuild
+        node.nodetool('drain')
+        node.stop()
+        cluster.start()
+        session = self.patient_cql_connection(node)
+        session.execute("USE keyspace1")
+
+        # The index should remain not built nor queryable after restart
+        assert_none(session, """SELECT * FROM system."IndexInfo" WHERE table_name='keyspace1'""")
+        assert_invalid(session,
+                       'SELECT * FROM standard1 WHERE "C0" = 0x00',
+                       'Cannot execute this query as it might involve data filtering')
+
+    @since('4.0')
+    def test_index_is_not_always_rebuilt_at_start(self):
+        """
+        @jira_ticket CASSANDRA-10130
+
+        Tests the management of index status during manual index rebuilding failures.
+        """
+
+        cluster = self.cluster
+        cluster.populate(1, install_byteman=True).start(wait_for_binary_proto=True)
+        node = cluster.nodelist()[0]
+
+        session = self.patient_cql_connection(node)
+        create_ks(session, 'k', 1)
+        session.execute("CREATE TABLE k.t (k int PRIMARY KEY, v int)")
+        session.execute("CREATE INDEX idx ON k.t(v)")
+        session.execute("INSERT INTO k.t(k, v) VALUES (0, 1)")
+        session.execute("INSERT INTO k.t(k, v) VALUES (2, 3)")
+
+        # Verify that the index is marked as built and it can answer queries
+        assert_one(session, """SELECT * FROM system."IndexInfo" WHERE table_name='k'""", ['k', 'idx'])
+        assert_one(session, "SELECT * FROM k.t WHERE v = 1", [0, 1])
+
+        # Restart the node to trigger any eventual undesired index rebuild
+        before_files = self._index_sstables_files(node, 'k', 't', 'idx')
+        node.nodetool('drain')
+        node.stop()
+        cluster.start()
+        session = self.patient_cql_connection(node)
+        session.execute("USE k")
+        after_files = self._index_sstables_files(node, 'k', 't', 'idx')
+
+        # Verify that, the index is not rebuilt, marked as built, and it can answer queries
+        self.assertNotEqual(before_files, after_files)
+        assert_one(session, """SELECT * FROM system."IndexInfo" WHERE table_name='k'""", ['k', 'idx'])
+        assert_one(session, "SELECT * FROM k.t WHERE v = 1", [0, 1])
+
     def test_multi_index_filtering_query(self):
         """
         asserts that having multiple indexes that cover all predicates still requires ALLOW FILTERING to also be present

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/50e1e7b1/sstable_generation_loading_test.py
----------------------------------------------------------------------
diff --git a/sstable_generation_loading_test.py b/sstable_generation_loading_test.py
index e04d714..37ea8e3 100644
--- a/sstable_generation_loading_test.py
+++ b/sstable_generation_loading_test.py
@@ -6,7 +6,8 @@ from distutils import dir_util
 from ccmlib import common as ccmcommon
 
 from dtest import Tester, debug, create_ks, create_cf
-from tools.assertions import assert_one
+from tools.assertions import assert_all, assert_none, assert_one
+from tools.decorators import since
 
 
 # WARNING: sstableloader tests should be added to TestSSTableGenerationAndLoading (below),
@@ -68,6 +69,34 @@ class BaseSStableLoaderTest(Tester):
 
         self.load_sstable_with_configuration(ks='"Keyspace1"', create_schema=create_schema_with_mv)
 
+    def copy_sstables(self, cluster, node):
+        for x in xrange(0, cluster.data_dir_count):
+            data_dir = os.path.join(node.get_path(), 'data{0}'.format(x))
+            copy_root = os.path.join(node.get_path(), 'data{0}_copy'.format(x))
+            for ddir in os.listdir(data_dir):
+                keyspace_dir = os.path.join(data_dir, ddir)
+                if os.path.isdir(keyspace_dir) and ddir != 'system':
+                    copy_dir = os.path.join(copy_root, ddir)
+                    dir_util.copy_tree(keyspace_dir, copy_dir)
+
+    def load_sstables(self, cluster, node, ks):
+        cdir = node.get_install_dir()
+        sstableloader = os.path.join(cdir, 'bin', ccmcommon.platform_binary('sstableloader'))
+        env = ccmcommon.make_cassandra_env(cdir, node.get_path())
+        host = node.address()
+        for x in xrange(0, cluster.data_dir_count):
+            sstablecopy_dir = os.path.join(node.get_path(), 'data{0}_copy'.format(x), ks.strip('"'))
+            for cf_dir in os.listdir(sstablecopy_dir):
+                full_cf_dir = os.path.join(sstablecopy_dir, cf_dir)
+                if os.path.isdir(full_cf_dir):
+                    cmd_args = [sstableloader, '--nodes', host, full_cf_dir]
+                    p = subprocess.Popen(cmd_args, stderr=subprocess.PIPE, stdout=subprocess.PIPE, env=env)
+                    exit_status = p.wait()
+                    debug('stdout: {out}'.format(out=p.stdout))
+                    debug('stderr: {err}'.format(err=p.stderr))
+                    self.assertEqual(0, exit_status,
+                                     "sstableloader exited with a non-zero status: {}".format(exit_status))
+
     def load_sstable_with_configuration(self, pre_compression=None, post_compression=None, ks="ks", create_schema=create_schema):
         """
         tests that the sstableloader works by using it to load data.
@@ -112,14 +141,7 @@ class BaseSStableLoaderTest(Tester):
 
         debug("Making a copy of the sstables")
         # make a copy of the sstables
-        for x in xrange(0, cluster.data_dir_count):
-            data_dir = os.path.join(node1.get_path(), 'data{0}'.format(x))
-            copy_root = os.path.join(node1.get_path(), 'data{0}_copy'.format(x))
-            for ddir in os.listdir(data_dir):
-                keyspace_dir = os.path.join(data_dir, ddir)
-                if os.path.isdir(keyspace_dir) and ddir != 'system':
-                    copy_dir = os.path.join(copy_root, ddir)
-                    dir_util.copy_tree(keyspace_dir, copy_dir)
+        self.copy_sstables(cluster, node1)
 
         debug("Wiping out the data and restarting cluster")
         # wipe out the node data.
@@ -140,22 +162,7 @@ class BaseSStableLoaderTest(Tester):
 
         debug("Calling sstableloader")
         # call sstableloader to re-load each cf.
-        cdir = node1.get_install_dir()
-        sstableloader = os.path.join(cdir, 'bin', ccmcommon.platform_binary('sstableloader'))
-        env = ccmcommon.make_cassandra_env(cdir, node1.get_path())
-        host = node1.address()
-        for x in xrange(0, cluster.data_dir_count):
-            sstablecopy_dir = os.path.join(node1.get_path(), 'data{0}_copy'.format(x), ks.strip('"'))
-            for cf_dir in os.listdir(sstablecopy_dir):
-                full_cf_dir = os.path.join(sstablecopy_dir, cf_dir)
-                if os.path.isdir(full_cf_dir):
-                    cmd_args = [sstableloader, '--nodes', host, full_cf_dir]
-                    p = subprocess.Popen(cmd_args, stderr=subprocess.PIPE, stdout=subprocess.PIPE, env=env)
-                    exit_status = p.wait()
-                    debug('stdout: {out}'.format(out=p.stdout))
-                    debug('stderr: {err}'.format(err=p.stderr))
-                    self.assertEqual(0, exit_status,
-                                     "sstableloader exited with a non-zero status: {}".format(exit_status))
+        self.load_sstables(cluster, node1, ks)
 
         def read_and_validate_data(session):
             for i in range(NUM_KEYS):
@@ -287,3 +294,68 @@ class TestSSTableGenerationAndLoading(BaseSStableLoaderTest):
                             "PRIMARY KEY (v)")
 
         self.load_sstable_with_configuration(ks='"Keyspace1"', create_schema=create_schema_with_mv)
+
+    @since('4.0')
+    def sstableloader_with_failing_2i_test(self):
+        """
+        @jira_ticket CASSANDRA-10130
+
+        Simulates an index building failure during SSTables load.
+        The table data should be loaded and the index should be marked for rebuilding during the next node start.
+        """
+        def create_schema_with_2i(session):
+            create_ks(session, 'k', 1)
+            session.execute("CREATE TABLE k.t (p int, c int, v int, PRIMARY KEY(p, c))")
+            session.execute("CREATE INDEX idx ON k.t(v)")
+
+        cluster = self.cluster
+        cluster.populate(1, install_byteman=True).start(wait_for_binary_proto=True)
+        node = cluster.nodelist()[0]
+
+        session = self.patient_cql_connection(node)
+        create_schema_with_2i(session)
+        session.execute("INSERT INTO k.t(p, c, v) VALUES (0, 1, 8)")
+
+        # Stop node and copy SSTables
+        node.nodetool('drain')
+        node.stop()
+        self.copy_sstables(cluster, node)
+
+        # Wipe out data and restart
+        cluster.clear()
+        cluster.start()
+
+        # Restore the schema
+        session = self.patient_cql_connection(node)
+        create_schema_with_2i(session)
+
+        # The table should exist and be empty, and the index should be empty and marked as built
+        assert_one(session, """SELECT * FROM system."IndexInfo" WHERE table_name='k'""", ['k', 'idx'])
+        assert_none(session, "SELECT * FROM k.t")
+        assert_none(session, "SELECT * FROM k.t WHERE v = 8")
+
+        # Add some additional data before loading the SSTable, to check that it will be still accessible
+        session.execute("INSERT INTO k.t(p, c, v) VALUES (0, 2, 8)")
+        assert_one(session, "SELECT * FROM k.t", [0, 2, 8])
+        assert_one(session, "SELECT * FROM k.t WHERE v = 8", [0, 2, 8])
+
+        # Load SSTables with a failure during index creation
+        node.byteman_submit(['./byteman/index_build_failure.btm'])
+        with self.assertRaises(Exception):
+            self.load_sstables(cluster, node, 'k')
+
+        # Check that the index isn't marked as built and the old SSTable data has been loaded but not indexed
+        assert_none(session, """SELECT * FROM system."IndexInfo" WHERE table_name='k'""")
+        assert_all(session, "SELECT * FROM k.t", [[0, 1, 8], [0, 2, 8]])
+        assert_one(session, "SELECT * FROM k.t WHERE v = 8", [0, 2, 8])
+
+        # Restart the node to trigger index rebuild
+        node.nodetool('drain')
+        node.stop()
+        cluster.start()
+        session = self.patient_cql_connection(node)
+
+        # Check that the index is marked as built and the index has been rebuilt
+        assert_one(session, """SELECT * FROM system."IndexInfo" WHERE table_name='k'""", ['k', 'idx'])
+        assert_all(session, "SELECT * FROM k.t", [[0, 1, 8], [0, 2, 8]])
+        assert_all(session, "SELECT * FROM k.t WHERE v = 8", [[0, 1, 8], [0, 2, 8]])


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


[39/50] cassandra-dtest git commit: Restrict size estimates multi-dc test to run on 3.0.11+

Posted by zz...@apache.org.
Restrict size estimates multi-dc test to run on 3.0.11+


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

Branch: refs/heads/master
Commit: 3cf276e966f253a49df91293a1a0b46620192c59
Parents: f69ced0
Author: Joel Knighton <jo...@datastax.com>
Authored: Mon Jun 19 16:40:14 2017 -0500
Committer: Joel Knighton <jo...@datastax.com>
Committed: Mon Jun 19 16:40:14 2017 -0500

----------------------------------------------------------------------
 topology_test.py | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/3cf276e9/topology_test.py
----------------------------------------------------------------------
diff --git a/topology_test.py b/topology_test.py
index 7604ebe..15827f3 100644
--- a/topology_test.py
+++ b/topology_test.py
@@ -31,6 +31,7 @@ class TestTopology(Tester):
 
         node1.stop(gently=False)
 
+    @since('3.0.11')
     def size_estimates_multidc_test(self):
         """
         Test that primary ranges are correctly generated on


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


[33/50] cassandra-dtest git commit: Bump CCM version to 2.6.3

Posted by zz...@apache.org.
Bump CCM version to 2.6.3


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

Branch: refs/heads/master
Commit: 6f7caba9c59daa949e67efc28f75e7de4c5b9fa7
Parents: 7f3566a
Author: Joel Knighton <jo...@datastax.com>
Authored: Thu Jun 1 14:00:50 2017 -0500
Committer: Philip Thompson <pt...@gmail.com>
Committed: Fri Jun 2 11:49:37 2017 +0200

----------------------------------------------------------------------
 requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/6f7caba9/requirements.txt
----------------------------------------------------------------------
diff --git a/requirements.txt b/requirements.txt
index 40fb0e1..9be7094 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,7 +4,7 @@
 futures
 six
 -e git+https://github.com/datastax/python-driver.git@cassandra-test#egg=cassandra-driver
-ccm==2.6.0
+ccm==2.6.3
 cql
 decorator
 docopt


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


[06/50] cassandra-dtest git commit: Fix netstats_test to accept "Connection refused" messages pre- and post-Java 1.8u111

Posted by zz...@apache.org.
Fix netstats_test to accept "Connection refused" messages pre- and post-Java 1.8u111


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

Branch: refs/heads/master
Commit: cf2163198d1dee1339ee2d771d8a426e7dc3eb9d
Parents: c6e6a4e
Author: Joel Knighton <jo...@datastax.com>
Authored: Mon Mar 13 11:51:15 2017 -0500
Committer: Joel Knighton <jo...@gmail.com>
Committed: Wed Mar 15 11:50:33 2017 -0500

----------------------------------------------------------------------
 jmx_test.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/cf216319/jmx_test.py
----------------------------------------------------------------------
diff --git a/jmx_test.py b/jmx_test.py
index ec817b9..7251b12 100644
--- a/jmx_test.py
+++ b/jmx_test.py
@@ -28,7 +28,7 @@ class TestJMX(Tester):
         node1.flush()
         node1.stop(gently=False)
 
-        with self.assertRaisesRegexp(ToolError, "ConnectException: 'Connection refused'."):
+        with self.assertRaisesRegexp(ToolError, "ConnectException: 'Connection refused( \(Connection refused\))?'."):
             node1.nodetool('netstats')
 
         # don't wait; we're testing for when nodetool is called on a node mid-startup
@@ -48,7 +48,7 @@ class TestJMX(Tester):
                 if not isinstance(e, ToolError):
                     raise
                 else:
-                    self.assertIn("ConnectException: 'Connection refused'.", str(e))
+                    self.assertRegexpMatches(str(e), "ConnectException: 'Connection refused( \(Connection refused\))?'.")
 
         self.assertTrue(running, msg='node1 never started')
 


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


[32/50] cassandra-dtest git commit: Hinted handoff setmaxwindow test should only run on versions >= 4.0

Posted by zz...@apache.org.
Hinted handoff setmaxwindow test should only run on versions >= 4.0


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

Branch: refs/heads/master
Commit: 7f3566ad7b27b9caa8ceccb361b09e42113aa41b
Parents: bea71d8
Author: Joel Knighton <jo...@datastax.com>
Authored: Wed May 24 14:20:28 2017 -0500
Committer: Philip Thompson <pt...@gmail.com>
Committed: Tue May 30 14:18:24 2017 +0200

----------------------------------------------------------------------
 hintedhandoff_test.py | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/7f3566ad/hintedhandoff_test.py
----------------------------------------------------------------------
diff --git a/hintedhandoff_test.py b/hintedhandoff_test.py
index 1ed3305..6345e3c 100644
--- a/hintedhandoff_test.py
+++ b/hintedhandoff_test.py
@@ -121,6 +121,7 @@ class TestHintedHandoffConfig(Tester):
 
         self._do_hinted_handoff(node1, node2, True)
 
+    @since('4.0')
     def hintedhandoff_setmaxwindow_test(self):
         """
         Test global hinted handoff against max_hint_window_in_ms update via nodetool


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


[20/50] cassandra-dtest git commit: Merge pull request #1456 from stef1927/13364

Posted by zz...@apache.org.
Merge pull request #1456 from stef1927/13364

Added test case for CASSANDRA-13364

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

Branch: refs/heads/master
Commit: 0692e2b63b3efe507b4c87be3dd3afb90042b8f7
Parents: 8513c47 ec6b958
Author: Stefania Alborghetti <st...@datastax.com>
Authored: Fri Apr 7 09:11:07 2017 +0800
Committer: GitHub <no...@github.com>
Committed: Fri Apr 7 09:11:07 2017 +0800

----------------------------------------------------------------------
 cqlsh_tests/cqlsh_copy_tests.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------



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


[16/50] cassandra-dtest git commit: Restrict data dir for no_anticompaction_of_already_repaired_test

Posted by zz...@apache.org.
Restrict data dir for no_anticompaction_of_already_repaired_test


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

Branch: refs/heads/master
Commit: 2e24587b8c206eccca71ba7d93e7e0c75e718644
Parents: c17e011
Author: Paulo Motta <pa...@gmail.com>
Authored: Tue Apr 4 17:51:27 2017 -0300
Committer: Paulo Motta <pa...@gmail.com>
Committed: Tue Apr 4 17:51:27 2017 -0300

----------------------------------------------------------------------
 repair_tests/repair_test.py | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/2e24587b/repair_tests/repair_test.py
----------------------------------------------------------------------
diff --git a/repair_tests/repair_test.py b/repair_tests/repair_test.py
index 5148b00..5276556 100644
--- a/repair_tests/repair_test.py
+++ b/repair_tests/repair_test.py
@@ -295,6 +295,8 @@ class TestRepair(BaseRepairTest):
 
         cluster = self.cluster
         debug("Starting cluster..")
+        # disable JBOD conf since the test expects sstables to be on the same disk
+        cluster.set_datadir_count(1)
         cluster.populate(3).start(wait_for_binary_proto=True)
         node1, node2, node3 = cluster.nodelist()
         # we use RF to make sure to cover only a set of sub-ranges when doing -full -pr


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


[45/50] cassandra-dtest git commit: Expand 9673 tests to also run on 3.x

Posted by zz...@apache.org.
Expand 9673 tests to also run on 3.x


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

Branch: refs/heads/master
Commit: d2d9e6d4ef638233b8dc403c25c2265cc40df9be
Parents: 50e1e7b
Author: Philip Thompson <pt...@gmail.com>
Authored: Tue Jul 4 15:27:28 2017 +0200
Committer: Philip Thompson <pt...@gmail.com>
Committed: Wed Jul 5 11:51:36 2017 +0200

----------------------------------------------------------------------
 batch_test.py | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/d2d9e6d4/batch_test.py
----------------------------------------------------------------------
diff --git a/batch_test.py b/batch_test.py
index 6dcf786..e67d185 100644
--- a/batch_test.py
+++ b/batch_test.py
@@ -285,51 +285,51 @@ class TestBatch(Tester):
         assert_one(session, "SELECT * FROM users", [0, 'Jack', 'Sparrow'])
         assert_one(session, "SELECT * FROM dogs", [0, 'Pluto'])
 
-    @since('3.0', max_version='3.0.x')
+    @since('3.0', max_version='3.x')
     def logged_batch_compatibility_1_test(self):
         """
         @jira_ticket CASSANDRA-9673, test that logged batches still work with a mixed version cluster.
 
-        Here we have one 3.0 node and two 2.2 nodes and we send the batch request to the 3.0 node.
+        Here we have one 3.0/3.x node and two 2.2 nodes and we send the batch request to the 3.0 node.
         """
         self._logged_batch_compatibility_test(0, 1, 'github:apache/cassandra-2.2', 2, 4)
 
-    @since('3.0', max_version='3.0.x')
+    @since('3.0', max_version='3.x')
     @skipIf(sys.platform == 'win32', 'Windows production support only on 2.2+')
     def logged_batch_compatibility_2_test(self):
         """
         @jira_ticket CASSANDRA-9673, test that logged batches still work with a mixed version cluster.
 
-        Here we have one 3.0 node and two 2.1 nodes and we send the batch request to the 3.0 node.
+        Here we have one 3.0/3.x node and two 2.1 nodes and we send the batch request to the 3.0 node.
         """
         self._logged_batch_compatibility_test(0, 1, 'github:apache/cassandra-2.1', 2, 3)
 
-    @since('3.0', max_version='3.0.x')
+    @since('3.0', max_version='3.x')
     @skipIf(sys.platform == 'win32', 'Windows production support only on 2.2+')
     def logged_batch_compatibility_3_test(self):
         """
         @jira_ticket CASSANDRA-9673, test that logged batches still work with a mixed version cluster.
 
-        Here we have two 3.0 nodes and one 2.1 node and we send the batch request to the 3.0 node.
+        Here we have two 3.0/3.x nodes and one 2.1 node and we send the batch request to the 3.0 node.
         """
         self._logged_batch_compatibility_test(0, 2, 'github:apache/cassandra-2.1', 1, 3)
 
-    @since('3.0', max_version='3.0.x')
+    @since('3.0', max_version='3.x')
     def logged_batch_compatibility_4_test(self):
         """
         @jira_ticket CASSANDRA-9673, test that logged batches still work with a mixed version cluster.
 
-        Here we have two 3.0 nodes and one 2.2 node and we send the batch request to the 2.2 node.
+        Here we have two 3.0/3.x nodes and one 2.2 node and we send the batch request to the 2.2 node.
         """
         self._logged_batch_compatibility_test(2, 2, 'github:apache/cassandra-2.2', 1, 4)
 
-    @since('3.0', max_version='3.0.x')
+    @since('3.0', max_version='3.x')
     @skipIf(sys.platform == 'win32', 'Windows production support only on 2.2+')
     def logged_batch_compatibility_5_test(self):
         """
         @jira_ticket CASSANDRA-9673, test that logged batches still work with a mixed version cluster.
 
-        Here we have two 3.0 nodes and one 2.1 node and we send the batch request to the 2.1 node.
+        Here we have two 3.0/3.x nodes and one 2.1 node and we send the batch request to the 2.1 node.
         """
         self._logged_batch_compatibility_test(2, 2, 'github:apache/cassandra-2.1', 1, 3)
 


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


[47/50] cassandra-dtest git commit: Add tests for 'nodetool getbatchlogreplaythrottle' and 'nodetool setbatchlogreplaythrottle' (#1491)

Posted by zz...@apache.org.
Add tests for 'nodetool getbatchlogreplaythrottle' and 'nodetool setbatchlogreplaythrottle' (#1491)

* Add test for 'nodetool setbatchlogreplaythrottlekb'

* Check log messages about updates in batchlog replay throttle

* Add test for 'nodetool getbatchlogreplaythrottlekb'

* Adapt tests for the renaming of the nodetool accessors for batchlog replay throttle

* Remove unused imports

* Removed extra blank line at the end of the file


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

Branch: refs/heads/master
Commit: 8cd52d67587ddb5efc80366ff6c6a044c30b41d3
Parents: 557ab7b
Author: Andrés de la Peña <ad...@users.noreply.github.com>
Authored: Thu Jul 6 12:26:10 2017 +0100
Committer: GitHub <no...@github.com>
Committed: Thu Jul 6 12:26:10 2017 +0100

----------------------------------------------------------------------
 jmx_test.py      | 21 +++++++++++++++++++++
 nodetool_test.py | 22 ++++++++++++++++++++++
 2 files changed, 43 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/8cd52d67/jmx_test.py
----------------------------------------------------------------------
diff --git a/jmx_test.py b/jmx_test.py
index 7251b12..7df84ac 100644
--- a/jmx_test.py
+++ b/jmx_test.py
@@ -181,6 +181,27 @@ class TestJMX(Tester):
         self.assertGreater(endpoint2Phi, 0.0)
         self.assertLess(endpoint2Phi, max_phi)
 
+    @since('4.0')
+    def test_set_get_batchlog_replay_throttle(self):
+        """
+        @jira_ticket CASSANDRA-13614
+
+        Test that batchlog replay throttle can be set and get through JMX
+        """
+        cluster = self.cluster
+        cluster.populate(2)
+        node = cluster.nodelist()[0]
+        remove_perf_disable_shared_mem(node)
+        cluster.start()
+
+        # Set and get throttle with JMX, ensuring that the rate change is logged
+        with JolokiaAgent(node) as jmx:
+            mbean = make_mbean('db', 'StorageService')
+            jmx.write_attribute(mbean, 'BatchlogReplayThrottleInKB', 4096)
+            self.assertTrue(len(node.grep_log('Updating batchlog replay throttle to 4096 KB/s, 2048 KB/s per endpoint',
+                                              filename='debug.log')) > 0)
+            self.assertEqual(4096, jmx.read_attribute(mbean, 'BatchlogReplayThrottleInKB'))
+
 
 @since('3.9')
 class TestJMXSSL(Tester):

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/8cd52d67/nodetool_test.py
----------------------------------------------------------------------
diff --git a/nodetool_test.py b/nodetool_test.py
index ff4622b..d7ce89a 100644
--- a/nodetool_test.py
+++ b/nodetool_test.py
@@ -136,3 +136,25 @@ class TestNodetool(Tester):
         out, err, _ = node.nodetool('status')
         self.assertEqual(0, len(err), err)
         self.assertRegexpMatches(out, notice_message)
+
+    @since('4.0')
+    def test_set_get_batchlog_replay_throttle(self):
+        """
+        @jira_ticket CASSANDRA-13614
+
+        Test that batchlog replay throttle can be set and get through nodetool
+        """
+        cluster = self.cluster
+        cluster.populate(2)
+        node = cluster.nodelist()[0]
+        cluster.start()
+
+        # Test that nodetool help messages are displayed
+        self.assertTrue('Set batchlog replay throttle' in node.nodetool('help setbatchlogreplaythrottle').stdout)
+        self.assertTrue('Print batchlog replay throttle' in node.nodetool('help getbatchlogreplaythrottle').stdout)
+
+        # Set and get throttle with nodetool, ensuring that the rate change is logged
+        node.nodetool('setbatchlogreplaythrottle 2048')
+        self.assertTrue(len(node.grep_log('Updating batchlog replay throttle to 2048 KB/s, 1024 KB/s per endpoint',
+                                          filename='debug.log')) > 0)
+        self.assertTrue('Batchlog replay throttle: 2048 KB/s' in node.nodetool('getbatchlogreplaythrottle').stdout)


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


[48/50] cassandra-dtest git commit: Adds the ability to use uncompressed chunks in compressed files

Posted by zz...@apache.org.
Adds the ability to use uncompressed chunks in compressed files

Triggered when size of compressed data surpasses a configurable
threshold.

Patch by Branimir Lambov; reviewed by Ropert Stupp for CASSANDRA-10520


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

Branch: refs/heads/master
Commit: 058b95289bf815495fced0ac55a78bcceceea9fa
Parents: 8cd52d6
Author: Branimir Lambov <br...@datastax.com>
Authored: Tue Jan 17 16:25:07 2017 +0200
Committer: Alex Petrov <al...@coffeenco.de>
Committed: Thu Jul 6 15:18:19 2017 +0200

----------------------------------------------------------------------
 cqlsh_tests/cqlsh_tests.py | 44 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/058b9528/cqlsh_tests/cqlsh_tests.py
----------------------------------------------------------------------
diff --git a/cqlsh_tests/cqlsh_tests.py b/cqlsh_tests/cqlsh_tests.py
index e7bc11c..dee1891 100644
--- a/cqlsh_tests/cqlsh_tests.py
+++ b/cqlsh_tests/cqlsh_tests.py
@@ -847,7 +847,25 @@ VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, blobAsBoolean(0x), blobAsDec
                 PRIMARY KEY (id, col)
                 """
 
-        if self.cluster.version() >= LooseVersion('3.9'):
+        if self.cluster.version() >= LooseVersion('4.0'):
+            ret += """
+        ) WITH CLUSTERING ORDER BY (col ASC)
+            AND bloom_filter_fp_chance = 0.01
+            AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
+            AND comment = ''
+            AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
+            AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor', 'min_compress_ratio': '1.1'}
+            AND crc_check_chance = 1.0
+            AND dclocal_read_repair_chance = 0.1
+            AND default_time_to_live = 0
+            AND gc_grace_seconds = 864000
+            AND max_index_interval = 2048
+            AND memtable_flush_period_in_ms = 0
+            AND min_index_interval = 128
+            AND read_repair_chance = 0.0
+            AND speculative_retry = '99PERCENTILE';
+        """
+        elif self.cluster.version() >= LooseVersion('3.9'):
             ret += """
         ) WITH CLUSTERING ORDER BY (col ASC)
             AND bloom_filter_fp_chance = 0.01
@@ -913,7 +931,29 @@ VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, blobAsBoolean(0x), blobAsDec
             return ret + "\n" + col_idx_def
 
     def get_users_table_output(self):
-        if self.cluster.version() >= LooseVersion('3.9'):
+        if self.cluster.version() >= LooseVersion('4.0'):
+            return """
+        CREATE TABLE test.users (
+            userid text PRIMARY KEY,
+            age int,
+            firstname text,
+            lastname text
+        ) WITH bloom_filter_fp_chance = 0.01
+            AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
+            AND comment = ''
+            AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
+            AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor', 'min_compress_ratio': '1.1'}
+            AND crc_check_chance = 1.0
+            AND dclocal_read_repair_chance = 0.1
+            AND default_time_to_live = 0
+            AND gc_grace_seconds = 864000
+            AND max_index_interval = 2048
+            AND memtable_flush_period_in_ms = 0
+            AND min_index_interval = 128
+            AND read_repair_chance = 0.0
+            AND speculative_retry = '99PERCENTILE';
+        """ + self.get_index_output('myindex', 'test', 'users', 'age')
+        elif self.cluster.version() >= LooseVersion('3.9'):
             return """
         CREATE TABLE test.users (
             userid text PRIMARY KEY,


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


[12/50] cassandra-dtest git commit: Make simple_bootstrap_test_small_keepalive_period faster/predictable with byteman

Posted by zz...@apache.org.
Make simple_bootstrap_test_small_keepalive_period faster/predictable with byteman


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

Branch: refs/heads/master
Commit: 737aab2fac109a2f8d3c840bc01f8bf22ab5fbe1
Parents: 795d91c
Author: Paulo Motta <pa...@gmail.com>
Authored: Thu Mar 30 19:43:58 2017 -0300
Committer: Paulo Motta <pa...@gmail.com>
Committed: Fri Mar 31 13:50:31 2017 -0300

----------------------------------------------------------------------
 bootstrap_test.py           | 23 ++++++++++++++---------
 byteman/stream_5s_sleep.btm | 13 +++++++++++++
 2 files changed, 27 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/737aab2f/bootstrap_test.py
----------------------------------------------------------------------
diff --git a/bootstrap_test.py b/bootstrap_test.py
index 048ab18..1d149e6 100644
--- a/bootstrap_test.py
+++ b/bootstrap_test.py
@@ -148,23 +148,28 @@ class TestBootstrap(BaseBootstrapTest):
         2*streaming_keep_alive_period_in_secs to receive a single sstable
         """
         cluster = self.cluster
-        cluster.set_configuration_options(values={'stream_throughput_outbound_megabits_per_sec': 1,
-                                                  'streaming_socket_timeout_in_ms': 1000,
-                                                  'streaming_keep_alive_period_in_secs': 1})
+        cluster.set_configuration_options(values={'streaming_socket_timeout_in_ms': 1000,
+                                                  'streaming_keep_alive_period_in_secs': 2})
 
         # Create a single node cluster
         cluster.populate(1)
         node1 = cluster.nodelist()[0]
+
+        debug("Setting up byteman on {}".format(node1.name))
+        # set up byteman
+        node1.byteman_port = '8100'
+        node1.import_config_files()
+
         cluster.start(wait_other_notice=True)
 
         # Create more than one sstable larger than 1MB
-        node1.stress(['write', 'n=50K', '-rate', 'threads=8', '-schema',
-                      'compaction(strategy=SizeTieredCompactionStrategy, enabled=false)'])
-        cluster.flush()
-        node1.stress(['write', 'n=50K', '-rate', 'threads=8', '-schema',
+        node1.stress(['write', 'n=1K', '-rate', 'threads=8', '-schema',
                       'compaction(strategy=SizeTieredCompactionStrategy, enabled=false)'])
         cluster.flush()
-        self.assertGreater(node1.get_sstables("keyspace1", "standard1"), 1)
+
+        debug("Submitting byteman script to {} to".format(node1.name))
+        # Sleep longer than streaming_socket_timeout_in_ms to make sure the node will not be killed
+        node1.byteman_submit(['./byteman/stream_5s_sleep.btm'])
 
         # Bootstraping a new node with very small streaming_socket_timeout_in_ms
         node2 = new_node(cluster)
@@ -174,7 +179,7 @@ class TestBootstrap(BaseBootstrapTest):
         assert_bootstrap_state(self, node2, 'COMPLETED')
 
         for node in cluster.nodelist():
-            self.assertTrue(node.grep_log('Scheduling keep-alive task with 1s period.', filename='debug.log'))
+            self.assertTrue(node.grep_log('Scheduling keep-alive task with 2s period.', filename='debug.log'))
             self.assertTrue(node.grep_log('Sending keep-alive', filename='debug.log'))
             self.assertTrue(node.grep_log('Received keep-alive', filename='debug.log'))
 

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/737aab2f/byteman/stream_5s_sleep.btm
----------------------------------------------------------------------
diff --git a/byteman/stream_5s_sleep.btm b/byteman/stream_5s_sleep.btm
new file mode 100644
index 0000000..0a4919a
--- /dev/null
+++ b/byteman/stream_5s_sleep.btm
@@ -0,0 +1,13 @@
+#
+# Sleep 5s during streaming session
+#
+RULE sleep 10s on stream session
+CLASS org.apache.cassandra.streaming.StreamSession
+METHOD messageReceived
+AT ENTRY
+# set flag to only run this rule once.
+IF NOT flagged("done")
+DO
+   flag("done");
+   Thread.sleep(5000)
+ENDRULE


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


[30/50] cassandra-dtest git commit: Add a sleep after compaction to give it time before checking SSTable directory for files (CASSANDRA-13182)

Posted by zz...@apache.org.
Add a sleep after compaction to give it time before checking SSTable directory for files (CASSANDRA-13182)


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

Branch: refs/heads/master
Commit: 538d658e0fb6b067ffeedd250c5997e2e77ad735
Parents: f148942
Author: Lerh Chuan Low <le...@instaclustr.com>
Authored: Tue May 16 16:09:32 2017 +1000
Committer: Philip Thompson <pt...@gmail.com>
Committed: Tue May 16 09:55:20 2017 -0400

----------------------------------------------------------------------
 sstableutil_test.py | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/538d658e/sstableutil_test.py
----------------------------------------------------------------------
diff --git a/sstableutil_test.py b/sstableutil_test.py
index a8f4487..0886a26 100644
--- a/sstableutil_test.py
+++ b/sstableutil_test.py
@@ -1,6 +1,7 @@
 import glob
 import os
 import subprocess
+import time
 
 from ccmlib import common
 from ccmlib.node import ToolError
@@ -40,6 +41,7 @@ class SSTableUtilTest(Tester):
         self.assertEqual(0, len(tmpfiles))
 
         node.compact()
+        time.sleep(5)
         finalfiles, tmpfiles = self._check_files(node, KeyspaceName, TableName)
         self.assertEqual(0, len(tmpfiles))
 


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


[14/50] cassandra-dtest git commit: Restrict data dir for sstabledump test

Posted by zz...@apache.org.
Restrict data dir for sstabledump test


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

Branch: refs/heads/master
Commit: c17e011b944ed29b57c29b6f6b2258de0d35f90b
Parents: 8b58b70
Author: Yuki Morishita <mo...@gmail.com>
Authored: Mon Apr 3 10:01:57 2017 +0900
Committer: Philip Thompson <pt...@gmail.com>
Committed: Mon Apr 3 10:05:47 2017 -0400

----------------------------------------------------------------------
 offline_tools_test.py | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/c17e011b/offline_tools_test.py
----------------------------------------------------------------------
diff --git a/offline_tools_test.py b/offline_tools_test.py
index 89d7ca9..3f9c2b7 100644
--- a/offline_tools_test.py
+++ b/offline_tools_test.py
@@ -389,6 +389,8 @@ class TestOfflineTools(Tester):
         Test that sstabledump functions properly offline to output the contents of a table.
         """
         cluster = self.cluster
+        # disable JBOD conf since the test expects exactly one SSTable to be written.
+        cluster.set_datadir_count(1)
         cluster.populate(1).start(wait_for_binary_proto=True)
         [node1] = cluster.nodelist()
         session = self.patient_cql_connection(node1)


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


[37/50] cassandra-dtest git commit: Repair preview tests should only run on 4.0+

Posted by zz...@apache.org.
Repair preview tests should only run on 4.0+


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

Branch: refs/heads/master
Commit: dfeb5dfb2930b1b9d236d1fa4ac159db53c1f60a
Parents: c93bd48
Author: Joel Knighton <jo...@datastax.com>
Authored: Fri Jun 16 14:53:32 2017 -0500
Committer: Philip Thompson <pt...@gmail.com>
Committed: Sat Jun 17 17:09:34 2017 +0200

----------------------------------------------------------------------
 repair_tests/preview_repair_test.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/dfeb5dfb/repair_tests/preview_repair_test.py
----------------------------------------------------------------------
diff --git a/repair_tests/preview_repair_test.py b/repair_tests/preview_repair_test.py
index e888a9b..86627ab 100644
--- a/repair_tests/preview_repair_test.py
+++ b/repair_tests/preview_repair_test.py
@@ -4,9 +4,10 @@ from cassandra import ConsistencyLevel
 from cassandra.query import SimpleStatement
 
 from dtest import Tester
-from tools.decorators import no_vnodes
+from tools.decorators import no_vnodes, since
 
 
+@since('4.0')
 class PreviewRepairTest(Tester):
 
     def assert_no_repair_history(self, session):


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


[13/50] cassandra-dtest git commit: Merge pull request #1458 from pauloricardomg/12929

Posted by zz...@apache.org.
Merge pull request #1458 from pauloricardomg/12929

Changed streaming keep alive test to use byteman (CASSANDRA-12929)

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

Branch: refs/heads/master
Commit: 8b58b7004658350af3083dab30de395353c52d41
Parents: ee6aa78 737aab2
Author: Paulo Ricardo Motta Gomes <pa...@gmail.com>
Authored: Mon Apr 3 10:51:40 2017 -0300
Committer: GitHub <no...@github.com>
Committed: Mon Apr 3 10:51:40 2017 -0300

----------------------------------------------------------------------
 bootstrap_test.py           | 23 ++++++++++++++---------
 byteman/stream_5s_sleep.btm | 13 +++++++++++++
 2 files changed, 27 insertions(+), 9 deletions(-)
----------------------------------------------------------------------



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


[27/50] cassandra-dtest git commit: Include quoted index names in describe test

Posted by zz...@apache.org.
Include quoted index names in describe test


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

Branch: refs/heads/master
Commit: f2925484f8e3375a3373b689b425a80f7ec54f36
Parents: 6540ba4
Author: Sam Tunnicliffe <sa...@beobal.com>
Authored: Thu Oct 27 09:25:26 2016 +0100
Committer: Philip Thompson <pt...@gmail.com>
Committed: Thu May 11 14:24:05 2017 -0400

----------------------------------------------------------------------
 cqlsh_tests/cqlsh_tests.py | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/f2925484/cqlsh_tests/cqlsh_tests.py
----------------------------------------------------------------------
diff --git a/cqlsh_tests/cqlsh_tests.py b/cqlsh_tests/cqlsh_tests.py
index caacaa5..7734848 100644
--- a/cqlsh_tests/cqlsh_tests.py
+++ b/cqlsh_tests/cqlsh_tests.py
@@ -688,6 +688,7 @@ VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, blobAsBoolean(0x), blobAsDec
                 CREATE KEYSPACE test WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor' : 1};
                 CREATE TABLE test.users ( userid text PRIMARY KEY, firstname text, lastname text, age int);
                 CREATE INDEX myindex ON test.users (age);
+                CREATE INDEX "QuotedNameIndex" on test.users (firstName);
                 CREATE TABLE test.test (id int, col int, val text, PRIMARY KEY(id, col));
                 CREATE INDEX ON test.test (col);
                 CREATE INDEX ON test.test (val)
@@ -738,7 +739,8 @@ VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, blobAsBoolean(0x), blobAsDec
         self.execute(cql='DESCRIBE test.myindex', expected_err="'myindex' not found in keyspace 'test'")
         self.execute(cql="""
                 CREATE TABLE test.users ( userid text PRIMARY KEY, firstname text, lastname text, age int);
-                CREATE INDEX myindex ON test.users (age)
+                CREATE INDEX myindex ON test.users (age);
+                CREATE INDEX "QuotedNameIndex" on test.users (firstname)
                 """)
         self.execute(cql="DESCRIBE test.users", expected_output=self.get_users_table_output())
         self.execute(cql='DESCRIBE test.myindex', expected_output=self.get_index_output('myindex', 'test', 'users', 'age'))
@@ -748,6 +750,10 @@ VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, blobAsBoolean(0x), blobAsDec
         self.execute(cql='DESCRIBE test.myindex', expected_err="'myindex' not found in keyspace 'test'")
         self.execute(cql='CREATE INDEX myindex ON test.users (age)')
         self.execute(cql='DESCRIBE INDEX test.myindex', expected_output=self.get_index_output('myindex', 'test', 'users', 'age'))
+        self.execute(cql='DROP INDEX test."QuotedNameIndex"')
+        self.execute(cql='DESCRIBE test."QuotedNameIndex"', expected_err="'QuotedNameIndex' not found in keyspace 'test'")
+        self.execute(cql='CREATE INDEX "QuotedNameIndex" ON test.users (firstname)')
+        self.execute(cql='DESCRIBE INDEX test."QuotedNameIndex"', expected_output=self.get_index_output('"QuotedNameIndex"', 'test', 'users', 'firstname'))
 
         # Alter table. Renaming indexed columns is not allowed, and since 3.0 neither is dropping them
         # Prior to 3.0 the index would have been automatically dropped, but now we need to explicitly do that.
@@ -929,7 +935,8 @@ VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, blobAsBoolean(0x), blobAsDec
             AND min_index_interval = 128
             AND read_repair_chance = 0.0
             AND speculative_retry = '99PERCENTILE';
-        """ + self.get_index_output('myindex', 'test', 'users', 'age')
+        """ + self.get_index_output('"QuotedNameIndex"', 'test', 'users', 'firstname') \
+                   + "\n" + self.get_index_output('myindex', 'test', 'users', 'age')
         elif self.cluster.version() >= LooseVersion('3.0'):
             return """
         CREATE TABLE test.users (
@@ -951,7 +958,8 @@ VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, blobAsBoolean(0x), blobAsDec
             AND min_index_interval = 128
             AND read_repair_chance = 0.0
             AND speculative_retry = '99PERCENTILE';
-        """ + self.get_index_output('myindex', 'test', 'users', 'age')
+        """ + self.get_index_output('"QuotedNameIndex"', 'test', 'users', 'firstname') \
+                   + "\n" + self.get_index_output('myindex', 'test', 'users', 'age')
         else:
             return """
         CREATE TABLE test.users (
@@ -972,7 +980,8 @@ VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, blobAsBoolean(0x), blobAsDec
             AND min_index_interval = 128
             AND read_repair_chance = 0.0
             AND speculative_retry = '99.0PERCENTILE';
-        """ + self.get_index_output('myindex', 'test', 'users', 'age')
+        """ + self.get_index_output('"QuotedNameIndex"', 'test', 'users', 'firstname') \
+                   + "\n" + self.get_index_output('myindex', 'test', 'users', 'age')
 
     def get_index_output(self, index, ks, table, col):
         return "CREATE INDEX {} ON {}.{} ({});".format(index, ks, table, col)


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


[17/50] cassandra-dtest git commit: Merge pull request #1462 from pauloricardomg/fix_anticompaction_of_already_repaired_test

Posted by zz...@apache.org.
Merge pull request #1462 from pauloricardomg/fix_anticompaction_of_already_repaired_test

Restrict data dir for no_anticompaction_of_already_repaired_test

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

Branch: refs/heads/master
Commit: 864f9562e7da70a749eb012c184f1787de5be01e
Parents: b93fd83 2e24587
Author: Paulo Ricardo Motta Gomes <pa...@gmail.com>
Authored: Tue Apr 4 18:15:50 2017 -0300
Committer: GitHub <no...@github.com>
Committed: Tue Apr 4 18:15:50 2017 -0300

----------------------------------------------------------------------
 repair_tests/repair_test.py | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------



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


[29/50] cassandra-dtest git commit: Add upgrade test for old format indexed sstables (CASSANDRA-13236)

Posted by zz...@apache.org.
Add upgrade test for old format indexed sstables (CASSANDRA-13236)


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

Branch: refs/heads/master
Commit: f1489423113713d04a1ef1a2bd4e9160abaea4b1
Parents: 5c99d20
Author: Sam Tunnicliffe <sa...@beobal.com>
Authored: Thu May 4 18:04:56 2017 -0700
Committer: Philip Thompson <pt...@gmail.com>
Committed: Thu May 11 14:31:57 2017 -0400

----------------------------------------------------------------------
 upgrade_tests/storage_engine_upgrade_test.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/f1489423/upgrade_tests/storage_engine_upgrade_test.py
----------------------------------------------------------------------
diff --git a/upgrade_tests/storage_engine_upgrade_test.py b/upgrade_tests/storage_engine_upgrade_test.py
index ac578dc..aa1cc27 100644
--- a/upgrade_tests/storage_engine_upgrade_test.py
+++ b/upgrade_tests/storage_engine_upgrade_test.py
@@ -215,12 +215,18 @@ class TestStorageEngineUpgrade(Tester):
             assert_one(session, "SELECT * FROM t WHERE k = {}".format(n), [n, n + 1, n + 2, n + 3, n + 4])
 
     def upgrade_with_statics_test(self):
+        self.upgrade_with_statics(rows=10)
+
+    def upgrade_with_wide_partition_and_statics_test(self):
+        """ Checks we read old indexed sstables with statics by creating partitions larger than a single index block"""
+        self.upgrade_with_statics(rows=1000)
+
+    def upgrade_with_statics(self, rows):
         """
         Validates we can read legacy sstables with static columns.
         """
         PARTITIONS = 1
-        ROWS = 10
-
+        ROWS = rows
         session = self._setup_cluster()
 
         session.execute('CREATE TABLE t (k int, s1 int static, s2 int static, t int, v1 int, v2 int, PRIMARY KEY (k, t))')


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


[36/50] cassandra-dtest git commit: Reformated git install formatting from, 'git:cassandra-2.2', to, 'github:apache/cassandra-2.2'.

Posted by zz...@apache.org.
Reformated git install formatting from, 'git:cassandra-2.2', to, 'github:apache/cassandra-2.2'.


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

Branch: refs/heads/master
Commit: c93bd48712f32aaff475bc3265968b36c6665229
Parents: ef84f76
Author: MichaelHamm <mi...@gmail.com>
Authored: Fri Jun 9 14:21:42 2017 -0700
Committer: Philip Thompson <pt...@gmail.com>
Committed: Mon Jun 12 13:02:54 2017 +0200

----------------------------------------------------------------------
 mixed_version_test.py            |  4 ++--
 offline_tools_test.py            | 14 +++++++-------
 upgrade_crc_check_chance_test.py |  2 +-
 upgrade_internal_auth_test.py    |  6 +++---
 4 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/c93bd487/mixed_version_test.py
----------------------------------------------------------------------
diff --git a/mixed_version_test.py b/mixed_version_test.py
index f60584a..9da28b9 100644
--- a/mixed_version_test.py
+++ b/mixed_version_test.py
@@ -21,9 +21,9 @@ class TestSchemaChanges(Tester):
         node1, node2 = cluster.nodelist()
         original_version = node1.get_cassandra_version()
         if original_version.vstring.startswith('2.0'):
-            upgraded_version = 'git:cassandra-2.1'
+            upgraded_version = 'github:apache/cassandra-2.1'
         elif original_version.vstring.startswith('2.1'):
-            upgraded_version = 'git:cassandra-2.2'
+            upgraded_version = 'github:apache/cassandra-2.2'
         else:
             self.skip("This test is only designed to work with 2.0 and 2.1 right now")
 

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/c93bd487/offline_tools_test.py
----------------------------------------------------------------------
diff --git a/offline_tools_test.py b/offline_tools_test.py
index 3f9c2b7..c0a0010 100644
--- a/offline_tools_test.py
+++ b/offline_tools_test.py
@@ -329,19 +329,19 @@ class TestOfflineTools(Tester):
             # CCM doesn't handle this upgrade correctly and results in an error when flushing 2.1:
             #   Error opening zip file or JAR manifest missing : /home/mshuler/git/cassandra/lib/jamm-0.2.5.jar
             # The 2.1 installed jamm version is 0.3.0, but bin/cassandra.in.sh used by nodetool still has 0.2.5
-            # (when this is fixed in CCM issue #463, install version='git:cassandra-2.0' as below)
+            # (when this is fixed in CCM issue #463, install version='github:apache/cassandra-2.0' as below)
             self.skipTest('Skipping 2.1 test due to jamm.jar version upgrade problem in CCM node configuration.')
         elif testversion < '3.0':
-            debug('Test version: {} - installing git:cassandra-2.1'.format(testversion))
-            cluster.set_install_dir(version='git:cassandra-2.1')
+            debug('Test version: {} - installing github:apache/cassandra-2.1'.format(testversion))
+            cluster.set_install_dir(version='github:apache/cassandra-2.1')
         # As of 3.5, sstable format 'ma' from 3.0 is still the latest - install 2.2 to upgrade from
         elif testversion < '4.0':
-            debug('Test version: {} - installing git:cassandra-2.2'.format(testversion))
-            cluster.set_install_dir(version='git:cassandra-2.2')
+            debug('Test version: {} - installing github:apache/cassandra-2.2'.format(testversion))
+            cluster.set_install_dir(version='github:apache/cassandra-2.2')
         # From 4.0, one can only upgrade from 3.0
         else:
-            debug('Test version: {} - installing git:cassandra-3.0'.format(testversion))
-            cluster.set_install_dir(version='git:cassandra-3.0')
+            debug('Test version: {} - installing github:apache/cassandra-3.0'.format(testversion))
+            cluster.set_install_dir(version='github:apache/cassandra-3.0')
 
         # Start up last major version, write out an sstable to upgrade, and stop node
         cluster.populate(1).start(wait_for_binary_proto=True)

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/c93bd487/upgrade_crc_check_chance_test.py
----------------------------------------------------------------------
diff --git a/upgrade_crc_check_chance_test.py b/upgrade_crc_check_chance_test.py
index 0367104..ec758c2 100644
--- a/upgrade_crc_check_chance_test.py
+++ b/upgrade_crc_check_chance_test.py
@@ -25,7 +25,7 @@ class TestCrcCheckChanceUpgrade(Tester):
         cluster = self.cluster
 
         # Forcing cluster version on purpose
-        cluster.set_install_dir(version="git:cassandra-2.2")
+        cluster.set_install_dir(version="github:apache/cassandra-2.2")
         cluster.populate(2).start()
 
         node1, node2 = cluster.nodelist()

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/c93bd487/upgrade_internal_auth_test.py
----------------------------------------------------------------------
diff --git a/upgrade_internal_auth_test.py b/upgrade_internal_auth_test.py
index 2c5681d..62acac9 100644
--- a/upgrade_internal_auth_test.py
+++ b/upgrade_internal_auth_test.py
@@ -23,12 +23,12 @@ class TestAuthUpgrade(Tester):
     )
 
     def upgrade_to_22_test(self):
-        self.do_upgrade_with_internal_auth("git:cassandra-2.2")
+        self.do_upgrade_with_internal_auth("github:apache/cassandra-2.2")
 
     @since('3.0')
     @skipIf(OFFHEAP_MEMTABLES, 'offheap_objects are not available in 3.0')
     def upgrade_to_30_test(self):
-        self.do_upgrade_with_internal_auth("git:cassandra-3.0")
+        self.do_upgrade_with_internal_auth("github:apache/cassandra-3.0")
 
     @since('2.2', max_version='3.X')
     def test_upgrade_legacy_table(self):
@@ -101,7 +101,7 @@ class TestAuthUpgrade(Tester):
         cluster = self.cluster
 
         # Forcing cluster version on purpose
-        cluster.set_install_dir(version="git:cassandra-2.1")
+        cluster.set_install_dir(version="github:apache/cassandra-2.1")
         cluster.populate(3).start()
 
         node1, node2, node3 = cluster.nodelist()


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


[42/50] cassandra-dtest git commit: Force decommission on topology test where required on 4.0+, run with vnodes

Posted by zz...@apache.org.
Force decommission on topology test where required on 4.0+, run with vnodes


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

Branch: refs/heads/master
Commit: c368a9098a4f5c8bd476257019154bf700963294
Parents: 1cc4941
Author: Joel Knighton <jo...@datastax.com>
Authored: Mon Jun 19 14:53:06 2017 -0500
Committer: Philip Thompson <pt...@gmail.com>
Committed: Tue Jun 20 12:10:58 2017 +0200

----------------------------------------------------------------------
 topology_test.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/c368a909/topology_test.py
----------------------------------------------------------------------
diff --git a/topology_test.py b/topology_test.py
index 15827f3..45c1c73 100644
--- a/topology_test.py
+++ b/topology_test.py
@@ -351,7 +351,6 @@ class TestTopology(Tester):
             query_c1c2(session, n, ConsistencyLevel.ONE)
 
     @since('3.0')
-    @no_vnodes()
     def decommissioned_node_cant_rejoin_test(self):
         '''
         @jira_ticket CASSANDRA-8801
@@ -375,7 +374,7 @@ class TestTopology(Tester):
         node1, node2, node3 = self.cluster.nodelist()
 
         debug('decommissioning...')
-        node3.decommission()
+        node3.decommission(force=self.cluster.version() >= '4.0')
         debug('stopping...')
         node3.stop()
         debug('attempting restart...')


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


[46/50] cassandra-dtest git commit: Fix do_upgrade in batch_test.py to upgrade to the current version

Posted by zz...@apache.org.
Fix do_upgrade in batch_test.py to upgrade to the current version


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

Branch: refs/heads/master
Commit: 557ab7b6b7c62e341b3ec9c8e7041f7731a1c0bd
Parents: d2d9e6d
Author: Philip Thompson <pt...@gmail.com>
Authored: Wed Jul 5 11:40:30 2017 +0200
Committer: Philip Thompson <pt...@gmail.com>
Committed: Wed Jul 5 11:51:36 2017 +0200

----------------------------------------------------------------------
 batch_test.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/557ab7b6/batch_test.py
----------------------------------------------------------------------
diff --git a/batch_test.py b/batch_test.py
index e67d185..4194f10 100644
--- a/batch_test.py
+++ b/batch_test.py
@@ -5,7 +5,7 @@ from unittest import skipIf
 from cassandra import ConsistencyLevel, Timeout, Unavailable
 from cassandra.query import SimpleStatement
 
-from dtest import CASSANDRA_DIR, Tester, debug, create_ks
+from dtest import Tester, create_ks, debug
 from tools.assertions import (assert_all, assert_invalid, assert_one,
                               assert_unavailable)
 from tools.decorators import since
@@ -433,7 +433,7 @@ class TestBatch(Tester):
         node.watch_log_for("DRAINED")
         node.stop(wait_other_notice=False)
 
-        node.set_install_dir(install_dir=CASSANDRA_DIR)
+        self.set_node_to_current_version(node)
         debug("Set new cassandra dir for {}: {}".format(node.name, node.get_install_dir()))
 
         # Restart nodes on new version


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


[04/50] cassandra-dtest git commit: Fix for materialized_views_tests to wait for the build to finish before any checks

Posted by zz...@apache.org.
Fix for materialized_views_tests to wait for the build to finish before any checks


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

Branch: refs/heads/master
Commit: 21d473644ddd1a892b76db419ae454fb72f83465
Parents: 13a8ec4
Author: T Jake Luciani <ja...@apache.org>
Authored: Thu Feb 23 17:12:48 2017 -0500
Committer: T Jake Luciani <ja...@apache.org>
Committed: Thu Mar 9 11:31:32 2017 -0500

----------------------------------------------------------------------
 materialized_views_test.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/21d47364/materialized_views_test.py
----------------------------------------------------------------------
diff --git a/materialized_views_test.py b/materialized_views_test.py
index e8c86c0..0c9cdcb 100644
--- a/materialized_views_test.py
+++ b/materialized_views_test.py
@@ -90,6 +90,21 @@ class TestMaterializedViews(Tester):
                     time.sleep(0.1)
                     attempts -= 1
 
+    def _wait_for_view(self, ks, view):
+        debug("waiting for view")
+
+        def _view_build_finished(node):
+            s = self.patient_exclusive_cql_connection(node)
+            result = list(s.execute("SELECT * FROM system.views_builds_in_progress WHERE keyspace_name='%s' AND view_name='%s'" % (ks, view)))
+            return len(result) == 0
+
+        for node in self.cluster.nodelist():
+            if node.is_running():
+                attempts = 50  # 1 sec per attempt, so 50 seconds total
+                while attempts > 0 and not _view_build_finished(node):
+                    time.sleep(1)
+                    attempts -= 1
+
     def _insert_data(self, session):
         # insert data
         insert_stmt = "INSERT INTO users (username, password, gender, state, birth_year) VALUES "
@@ -184,6 +199,9 @@ class TestMaterializedViews(Tester):
         session.execute(("CREATE MATERIALIZED VIEW t_by_v AS SELECT * FROM t WHERE v IS NOT NULL "
                          "AND id IS NOT NULL PRIMARY KEY (v, id)"))
 
+        debug("wait for view to build")
+        self._wait_for_view("ks", "t_by_v")
+
         debug("wait that all batchlogs are replayed")
         self._replay_batchlogs()
 
@@ -204,6 +222,9 @@ class TestMaterializedViews(Tester):
         session.execute(("CREATE MATERIALIZED VIEW t_by_v AS SELECT * FROM t WHERE v IS NOT NULL "
                          "AND id IS NOT NULL PRIMARY KEY (v, id)"))
 
+        debug("wait for view to build")
+        self._wait_for_view("ks", "t_by_v")
+
         debug("wait that all batchlogs are replayed")
         self._replay_batchlogs()
 


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


[40/50] cassandra-dtest git commit: Merge pull request #1484 from jkni/since-size-estimates

Posted by zz...@apache.org.
Merge pull request #1484 from jkni/since-size-estimates

Restrict size estimates multi-dc test to run on 3.0.11+

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

Branch: refs/heads/master
Commit: 93aa3147a5feced7eb0cc4cfb852e8a67f9251e9
Parents: f69ced0 3cf276e
Author: Paulo Ricardo Motta Gomes <pa...@gmail.com>
Authored: Mon Jun 19 21:47:28 2017 -0500
Committer: GitHub <no...@github.com>
Committed: Mon Jun 19 21:47:28 2017 -0500

----------------------------------------------------------------------
 topology_test.py | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------



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


[03/50] cassandra-dtest git commit: Add dtest for CASSANDRA-13053

Posted by zz...@apache.org.
Add dtest for CASSANDRA-13053


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

Branch: refs/heads/master
Commit: 13a8ec4ba3c9e4edfee50bac2385bd769c62c25f
Parents: eb3b574
Author: Aleksey Yeschenko <al...@yeschenko.com>
Authored: Tue Mar 7 15:17:55 2017 +0000
Committer: Aleksey Yeschenko <al...@yeschenko.com>
Committed: Wed Mar 8 00:25:14 2017 +0000

----------------------------------------------------------------------
 auth_test.py | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/13a8ec4b/auth_test.py
----------------------------------------------------------------------
diff --git a/auth_test.py b/auth_test.py
index c321828..2749209 100644
--- a/auth_test.py
+++ b/auth_test.py
@@ -654,6 +654,39 @@ class TestAuth(Tester):
         rows = list(cathy.execute("TRUNCATE ks.cf"))
         self.assertItemsEqual(rows, [])
 
+    @since('2.2')
+    def grant_revoke_without_ks_specified_test(self):
+        """
+        * Launch a one node cluster
+        * Connect as the default superuser
+        * Create table ks.cf
+        * Create a new users, 'cathy' and 'bob', with no permissions
+        * Grant ALL on ks.cf to cathy
+        * As cathy, try granting SELECT on cf to bob, without specifying the ks; verify it fails
+        * As cathy, USE ks, try again, verify it works this time
+        """
+        self.prepare()
+
+        cassandra = self.get_session(user='cassandra', password='cassandra')
+
+        cassandra.execute("CREATE KEYSPACE ks WITH replication = {'class':'SimpleStrategy', 'replication_factor':1}")
+        cassandra.execute("CREATE TABLE ks.cf (id int primary key, val int)")
+
+        cassandra.execute("CREATE USER cathy WITH PASSWORD '12345'")
+        cassandra.execute("CREATE USER bob WITH PASSWORD '12345'")
+
+        cassandra.execute("GRANT ALL ON ks.cf TO cathy")
+
+        cathy = self.get_session(user='cathy', password='12345')
+        bob = self.get_session(user='bob', password='12345')
+
+        assert_invalid(cathy, "GRANT SELECT ON cf TO bob", "No keyspace has been specified. USE a keyspace, or explicitly specify keyspace.tablename")
+        assert_unauthorized(bob, "SELECT * FROM ks.cf", "User bob has no SELECT permission on <table ks.cf> or any of its parents")
+
+        cathy.execute("USE ks")
+        cathy.execute("GRANT SELECT ON cf TO bob")
+        bob.execute("SELECT * FROM ks.cf")
+
     def grant_revoke_auth_test(self):
         """
         * Launch a one node cluster


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


[08/50] cassandra-dtest git commit: Add test to reproduce CASSANDRA-13382

Posted by zz...@apache.org.
Add test to reproduce CASSANDRA-13382


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

Branch: refs/heads/master
Commit: aa0c412b69036a2980a2c5f228cd31cf589c684b
Parents: 7f29ad6
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Mon Mar 27 14:55:26 2017 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Tue Mar 28 14:39:37 2017 +0200

----------------------------------------------------------------------
 upgrade_tests/cql_tests.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/aa0c412b/upgrade_tests/cql_tests.py
----------------------------------------------------------------------
diff --git a/upgrade_tests/cql_tests.py b/upgrade_tests/cql_tests.py
index bd34269..d9245d2 100644
--- a/upgrade_tests/cql_tests.py
+++ b/upgrade_tests/cql_tests.py
@@ -5384,6 +5384,31 @@ class TestCQL(UpgradeTester):
 
             assert_one(cursor, "SELECT * FROM foo.bar", [0, 0])
 
+    @since('3.0')
+    def materialized_view_simple_test(self):
+        """
+        Test that creates and populate a simple materialized view.
+        @jira_ticket CASSANDRA-13382
+        """
+        cursor = self.prepare()
+
+        cursor.execute("CREATE KEYSPACE foo WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}")
+        cursor.execute("CREATE TABLE foo.test1 (k int, t int, v int, PRIMARY KEY(k, t))")
+
+        cursor.execute("""
+            CREATE MATERIALIZED VIEW foo.view1
+            AS SELECT * FROM foo.test1
+            WHERE v IS NOT NULL AND t IS NOT NULL
+            PRIMARY KEY (k, v, t)
+        """)
+
+        for i in range(0, 10):
+            cursor.execute("INSERT INTO foo.test1(k, t, v) VALUES (0, %d, %d)" % (i, 10 - i - 1))
+
+        for is_upgraded, cursor in self.do_upgrade(cursor):
+            debug("Querying {} node".format("upgraded" if is_upgraded else "old"))
+            assert_all(cursor, "SELECT v, t FROM foo.view1 WHERE k = 0", [[i, 10 - i - 1] for i in range(0, 10)])
+
 
 topology_specs = [
     {'NODES': 3,


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


[38/50] cassandra-dtest git commit: CASSANDRA-9143 change needs dtest change

Posted by zz...@apache.org.
CASSANDRA-9143 change needs dtest change

CASSANDRA-9143 introduced strict check for not allowing
incremental subrange repair.
dtest needs to pass `-full` to repair command to invoke subrange
repair.


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

Branch: refs/heads/master
Commit: f69ced02b99ecc641b4b8eb149d12afe97e6f100
Parents: dfeb5df
Author: Yuki Morishita <mo...@gmail.com>
Authored: Tue Mar 28 14:40:57 2017 +0900
Committer: Joel Knighton <jo...@gmail.com>
Committed: Mon Jun 19 15:34:24 2017 -0500

----------------------------------------------------------------------
 repair_tests/repair_test.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/f69ced02/repair_tests/repair_test.py
----------------------------------------------------------------------
diff --git a/repair_tests/repair_test.py b/repair_tests/repair_test.py
index 5276556..ad46d18 100644
--- a/repair_tests/repair_test.py
+++ b/repair_tests/repair_test.py
@@ -1047,9 +1047,9 @@ class TestRepair(BaseRepairTest):
         node2.stop(wait_other_notice=True)
         node1.stress(['write', 'n=1M', 'no-warmup', '-schema', 'replication(factor=3)', '-rate', 'threads=30'])
         node2.start(wait_for_binary_proto=True)
-        t1 = threading.Thread(target=node1.nodetool, args=('repair keyspace1 standard1 -st {} -et {}'.format(str(node3.initial_token), str(node1.initial_token)),))
-        t2 = threading.Thread(target=node2.nodetool, args=('repair keyspace1 standard1 -st {} -et {}'.format(str(node1.initial_token), str(node2.initial_token)),))
-        t3 = threading.Thread(target=node3.nodetool, args=('repair keyspace1 standard1 -st {} -et {}'.format(str(node2.initial_token), str(node3.initial_token)),))
+        t1 = threading.Thread(target=node1.nodetool, args=('repair keyspace1 standard1 -full -st {} -et {}'.format(str(node3.initial_token), str(node1.initial_token)),))
+        t2 = threading.Thread(target=node2.nodetool, args=('repair keyspace1 standard1 -full -st {} -et {}'.format(str(node1.initial_token), str(node2.initial_token)),))
+        t3 = threading.Thread(target=node3.nodetool, args=('repair keyspace1 standard1 -full -st {} -et {}'.format(str(node2.initial_token), str(node3.initial_token)),))
         t1.start()
         t2.start()
         t3.start()


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


[02/50] cassandra-dtest git commit: CASSANDRA-13294

Posted by zz...@apache.org.
CASSANDRA-13294


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

Branch: refs/heads/master
Commit: eb3b5749ef4f22460365ad8369ff668d68c5d85b
Parents: 6bb074f
Author: Marcus Eriksson <ma...@apache.org>
Authored: Mon Mar 6 14:38:14 2017 +0100
Committer: Philip Thompson <pt...@gmail.com>
Committed: Mon Mar 6 09:56:46 2017 -0500

----------------------------------------------------------------------
 upgrade_tests/regression_test.py | 70 +++++++++++++++++++++++++++++++++++
 upgrade_tests/upgrade_base.py    | 10 +++++
 2 files changed, 80 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/eb3b5749/upgrade_tests/regression_test.py
----------------------------------------------------------------------
diff --git a/upgrade_tests/regression_test.py b/upgrade_tests/regression_test.py
index 14a17f7..cff3c50 100644
--- a/upgrade_tests/regression_test.py
+++ b/upgrade_tests/regression_test.py
@@ -7,9 +7,15 @@ from cassandra import ConsistencyLevel as CL
 from nose.tools import assert_not_in
 
 from dtest import RUN_STATIC_UPGRADE_MATRIX
+from tools.jmxutils import (JolokiaAgent, make_mbean)
 from upgrade_base import UpgradeTester
 from upgrade_manifest import build_upgrade_pairs
 
+import glob
+import os
+import re
+import time
+
 
 class TestForRegressions(UpgradeTester):
     """
@@ -60,6 +66,70 @@ class TestForRegressions(UpgradeTester):
                 count = s[1].execute("select count(*) from financial.symbol_history where symbol='{}' and year={};".format(symbol, year))[0][0]
                 self.assertEqual(count, expected_rows, "actual {} did not match expected {}".format(count, expected_rows))
 
+    def test13294(self):
+        """
+        Tests upgrades with files having a bunch of files with the same prefix as another file
+
+        this file is then compacted and we verify that no other sstables are removed
+
+        @jira_ticket CASSANDRA-13294
+        """
+        cluster = self.cluster
+        cluster.set_datadir_count(1)  # we want the same prefix for all sstables
+        session = self.prepare(jolokia=True)
+        session.execute("CREATE KEYSPACE test13294 WITH replication={'class':'SimpleStrategy', 'replication_factor': 2};")
+        session.execute("CREATE TABLE test13294.t (id int PRIMARY KEY, d int) WITH compaction = {'class': 'SizeTieredCompactionStrategy','enabled':'false'}")
+        for x in xrange(0, 5):
+            session.execute("INSERT INTO test13294.t (id, d) VALUES (%d, %d)" % (x, x))
+            cluster.flush()
+
+        node1 = cluster.nodelist()[0]
+
+        sstables = node1.get_sstables('test13294', 't')
+        node1.stop(wait_other_notice=True)
+        generation_re = re.compile(r'(.*-)(\d+)(-.*)')
+        mul = 1
+        first_sstable = ''
+        for sstable in sstables:
+            res = generation_re.search(sstable)
+            if res:
+                glob_for = "%s%s-*" % (res.group(1), res.group(2))
+                for f in glob.glob(glob_for):
+                    res2 = generation_re.search(f)
+                    new_filename = "%s%s%s" % (res2.group(1), mul, res2.group(3))
+                    os.rename(f, new_filename)
+                    if first_sstable == '' and '-Data' in new_filename:
+                        first_sstable = new_filename  # we should compact this
+                mul = mul * 10
+        node1.start(wait_other_notice=True)
+        sessions = self.do_upgrade(session)
+        checked = False
+        for is_upgraded, cursor in sessions:
+            if is_upgraded:
+                sstables_before = self.get_all_sstables(node1)
+                self.compact_sstable(node1, first_sstable)
+                time.sleep(2)  # wait for sstables to get physically removed
+                sstables_after = self.get_all_sstables(node1)
+                # since autocompaction is disabled and we compact a single sstable above
+                # the number of sstables after should be the same as before.
+                self.assertEquals(len(sstables_before), len(sstables_after))
+                checked = True
+        self.assertTrue(checked)
+
+    def compact_sstable(self, node, sstable):
+        mbean = make_mbean('db', type='CompactionManager')
+        with JolokiaAgent(node) as jmx:
+            jmx.execute_method(mbean, 'forceUserDefinedCompaction', [sstable])
+
+    def get_all_sstables(self, node):
+        # note that node.get_sstables(...) only returns current version sstables
+        keyspace_dirs = [os.path.join(node.get_path(), "data{0}".format(x), "test13294") for x in xrange(0, node.cluster.data_dir_count)]
+        files = []
+        for d in keyspace_dirs:
+            for f in glob.glob(d + "/*/*Data*"):
+                files.append(f)
+        return files
+
 
 for path in build_upgrade_pairs():
     gen_class_name = TestForRegressions.__name__ + path.name

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/eb3b5749/upgrade_tests/upgrade_base.py
----------------------------------------------------------------------
diff --git a/upgrade_tests/upgrade_base.py b/upgrade_tests/upgrade_base.py
index 3d44cef..6d37468 100644
--- a/upgrade_tests/upgrade_base.py
+++ b/upgrade_tests/upgrade_base.py
@@ -5,6 +5,7 @@ from abc import ABCMeta
 from unittest import skipIf
 
 from ccmlib.common import get_version_from_build, is_win
+from tools.jmxutils import remove_perf_disable_shared_mem
 
 from dtest import CASSANDRA_VERSION_FROM_BUILD, DEBUG, Tester, debug, create_ks
 
@@ -60,6 +61,7 @@ class UpgradeTester(Tester):
         self.ignore_log_patterns = self.ignore_log_patterns[:] + [
             r'RejectedExecutionException.*ThreadPoolExecutor has shut down',  # see  CASSANDRA-12364
         ]
+        self.enable_for_jolokia = False
         super(UpgradeTester, self).__init__(*args, **kwargs)
 
     def setUp(self):
@@ -99,6 +101,10 @@ class UpgradeTester(Tester):
         cluster.populate(nodes)
         node1 = cluster.nodelist()[0]
         cluster.set_install_dir(version=self.UPGRADE_PATH.starting_version)
+        self.enable_for_jolokia = kwargs.pop('jolokia', False)
+        if self.enable_for_jolokia:
+            remove_perf_disable_shared_mem(node1)
+
         cluster.start(wait_for_binary_proto=True)
 
         node1 = cluster.nodelist()[0]
@@ -157,6 +163,10 @@ class UpgradeTester(Tester):
                       'with Cassandra version {}'.format(self.protocol_version, new_version_from_build))
         node1.set_log_level("DEBUG" if DEBUG else "INFO")
         node1.set_configuration_options(values={'internode_compression': 'none'})
+
+        if self.enable_for_jolokia:
+            remove_perf_disable_shared_mem(node1)
+
         node1.start(wait_for_binary_proto=True, wait_other_notice=True)
 
         sessions_and_meta = []


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