You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by pa...@apache.org on 2017/09/05 06:05:15 UTC
[01/50] cassandra git commit: Merge pull request #1456 from
stef1927/13364
Repository: cassandra
Updated Branches:
refs/heads/master [created] 6d77ace53
Merge pull request #1456 from stef1927/13364
Added test case for CASSANDRA-13364
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0692e2b6
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0692e2b6
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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
[18/50] cassandra git commit: Repair preview tests should only run on
4.0+
Posted by pa...@apache.org.
Repair preview tests should only run on 4.0+
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/dfeb5dfb
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/dfeb5dfb
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[06/50] cassandra git commit: New test for CASSANDRA-11720;
Changing `max_hint_window_in_ms` at runtime
Posted by pa...@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/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6540ba4b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6540ba4b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[45/50] cassandra git commit: Add test to verify that it is possible
to list roles after a successful login (CASSANDRA-13640)
Posted by pa...@apache.org.
Add test to verify that it is possible to list roles after a successful login (CASSANDRA-13640)
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/da6ad831
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/da6ad831
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/da6ad831
Branch: refs/heads/master
Commit: da6ad8317e18ebaa5e8b428df79d1da086a19dd9
Parents: 1a0e266
Author: Andrés de la Peña <a....@gmail.com>
Authored: Thu Aug 24 16:47:58 2017 +0100
Committer: Andrés de la Peña <a....@gmail.com>
Committed: Thu Aug 24 16:47:58 2017 +0100
----------------------------------------------------------------------
cqlsh_tests/cqlsh_tests.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/da6ad831/cqlsh_tests/cqlsh_tests.py
----------------------------------------------------------------------
diff --git a/cqlsh_tests/cqlsh_tests.py b/cqlsh_tests/cqlsh_tests.py
index 418b9f7..8b66a53 100644
--- a/cqlsh_tests/cqlsh_tests.py
+++ b/cqlsh_tests/cqlsh_tests.py
@@ -2032,3 +2032,19 @@ class CqlLoginTest(Tester):
cqlsh_options=['-u', 'cassandra', '-p', 'cassandra'])
self.assertEqual([x for x in cqlsh_stdout.split() if x], ['ks1table'])
self.assert_login_not_allowed('user1', cqlsh_stderr)
+
+ def test_list_roles_after_login(self):
+ """
+ @jira_ticket CASSANDRA-13640
+
+ Verifies that it is possible to list roles after a successful login.
+ """
+ out, err, _ = self.node1.run_cqlsh(
+ '''
+ CREATE ROLE super WITH superuser = true AND password = 'p' AND login = true;
+ LOGIN super 'p';
+ LIST ROLES;
+ ''',
+ cqlsh_options=['-u', 'cassandra', '-p', 'cassandra'])
+ self.assertTrue('super' in out)
+ self.assertEqual('', err)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[37/50] cassandra git commit: Fix incorrect [2.1 <- 3.0]
serialization of counter cells created in 2.0
Posted by pa...@apache.org.
Fix incorrect [2.1 <- 3.0] serialization of counter cells created in 2.0
Also fixes calculation of legacy counter update cells' serialized size.
patch by Aleksey Yeschenko; reviewed by Sylvain Lebresne for CASSANDRA-13691
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/55c4ca8b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/55c4ca8b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/55c4ca8b
Branch: refs/heads/master
Commit: 55c4ca8bd450b81da6eed5055981b629b55dea15
Parents: d9c8ceb
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Sat Jul 15 01:21:04 2017 -0700
Committer: Aleksey Yeschenko <al...@yeschenko.com>
Committed: Tue Aug 1 15:43:34 2017 +0100
----------------------------------------------------------------------
counter_tests.py | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/55c4ca8b/counter_tests.py
----------------------------------------------------------------------
diff --git a/counter_tests.py b/counter_tests.py
index 80e6eca..c377060 100644
--- a/counter_tests.py
+++ b/counter_tests.py
@@ -13,6 +13,67 @@ from tools.decorators import since
class TestCounters(Tester):
+ @since('3.0', max_version='3.12')
+ def test_13691(self):
+ """
+ 2.0 -> 2.1 -> 3.0 counters upgrade test
+ @jira_ticket CASSANDRA-13691
+ """
+ cluster = self.cluster
+ default_install_dir = cluster.get_install_dir()
+
+ #
+ # set up a 2.0 cluster with 3 nodes and set up schema
+ #
+
+ cluster.set_install_dir(version='2.0.17')
+ cluster.populate(3)
+ cluster.start()
+
+ node1, node2, node3 = cluster.nodelist()
+
+ session = self.patient_cql_connection(node1)
+ session.execute("""
+ CREATE KEYSPACE test
+ WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3};
+ """)
+ session.execute("CREATE TABLE test.test (id int PRIMARY KEY, c counter);")
+
+ #
+ # generate some 2.0 counter columns with local shards
+ #
+
+ query = "UPDATE test.test SET c = c + 1 WHERE id = ?"
+ prepared = session.prepare(query)
+ for i in range(0, 1000):
+ session.execute(prepared, [i])
+
+ cluster.flush()
+ cluster.stop()
+
+ #
+ # upgrade cluster to 2.1
+ #
+
+ cluster.set_install_dir(version='2.1.17')
+ cluster.start();
+ cluster.nodetool("upgradesstables")
+
+ #
+ # upgrade node3 to current (3.0.x or 3.11.x)
+ #
+
+ node3.stop(wait_other_notice=True)
+ node3.set_install_dir(install_dir=default_install_dir)
+ node3.start(wait_other_notice=True)
+
+ #
+ # with a 2.1 coordinator, try to read the table with CL.ALL
+ #
+
+ session = self.patient_cql_connection(node1, consistency_level=ConsistencyLevel.ALL)
+ assert_one(session, "SELECT COUNT(*) FROM test.test", [1000])
+
def simple_increment_test(self):
""" Simple incrementation test (Created for #3465, that wasn't a bug) """
cluster = self.cluster
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[22/50] cassandra git commit: Removed cluster reuse from codebase
Posted by pa...@apache.org.
Removed cluster reuse from codebase
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/1cc49419
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1cc49419
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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/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/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/blob/1cc49419/dtest.py
----------------------------------------------------------------------
diff --git a/dtest.py b/dtest.py
index 1033c69..0fd5ec51 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/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
[49/50] cassandra git commit: ninja-fix misspelled variable name
Posted by pa...@apache.org.
ninja-fix misspelled variable name
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/19b6613d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/19b6613d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/19b6613d
Branch: refs/heads/master
Commit: 19b6613d7c1cd220432af1157b07dbba8fd4a0bb
Parents: 2ad557d
Author: Jason Brown <ja...@gmail.com>
Authored: Tue Aug 29 08:52:25 2017 -0700
Committer: Jason Brown <ja...@gmail.com>
Committed: Tue Aug 29 08:52:25 2017 -0700
----------------------------------------------------------------------
bootstrap_test.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/19b6613d/bootstrap_test.py
----------------------------------------------------------------------
diff --git a/bootstrap_test.py b/bootstrap_test.py
index 54c49c1..d29390c 100644
--- a/bootstrap_test.py
+++ b/bootstrap_test.py
@@ -150,7 +150,7 @@ class TestBootstrap(BaseBootstrapTest):
cluster = self.cluster
yaml_opts = {'streaming_keep_alive_period_in_secs': 2}
if cluster.version() < '4.0':
- yamp_opts['streaming_socket_timeout_in_ms'] = 1000
+ yaml_opts['streaming_socket_timeout_in_ms'] = 1000
cluster.set_configuration_options(values=yaml_opts)
# Create a single node cluster
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[30/50] cassandra git commit: Add a test for CASSANDRA-13346 (#1467)
Posted by pa...@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/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6f4e41e0
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6f4e41e0
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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/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
[44/50] cassandra git commit: update dtests to support netty-based
internode messaging/streaming
Posted by pa...@apache.org.
update dtests to support netty-based internode messaging/streaming
patch by jasobrown, reviewed by Marcus Eriksson for CASSANDRA-13635
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/1a0e2660
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1a0e2660
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1a0e2660
Branch: refs/heads/master
Commit: 1a0e266038e75930c69842e338c6a6ee196f721c
Parents: b8842b9
Author: Jason Brown <ja...@gmail.com>
Authored: Fri Jun 16 05:03:36 2017 -0700
Committer: Jason Brown <ja...@gmail.com>
Committed: Tue Aug 22 13:56:41 2017 -0700
----------------------------------------------------------------------
bootstrap_test.py | 11 ++++++++---
byteman/4.0/decommission_failure_inject.btm | 17 +++++++++++++++++
.../4.0/inject_failure_streaming_to_node2.btm | 17 +++++++++++++++++
byteman/4.0/stream_failure.btm | 17 +++++++++++++++++
byteman/decommission_failure_inject.btm | 17 -----------------
byteman/inject_failure_streaming_to_node2.btm | 17 -----------------
byteman/pre4.0/decommission_failure_inject.btm | 17 +++++++++++++++++
.../pre4.0/inject_failure_streaming_to_node2.btm | 17 +++++++++++++++++
byteman/pre4.0/stream_failure.btm | 17 +++++++++++++++++
byteman/stream_failure.btm | 17 -----------------
native_transport_ssl_test.py | 2 +-
nodetool_test.py | 8 +++++---
rebuild_test.py | 5 ++++-
replace_address_test.py | 10 +++++++---
secondary_indexes_test.py | 13 +++++++++++--
sslnodetonode_test.py | 19 +++++++++----------
topology_test.py | 5 ++++-
17 files changed, 151 insertions(+), 75 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a0e2660/bootstrap_test.py
----------------------------------------------------------------------
diff --git a/bootstrap_test.py b/bootstrap_test.py
index 1d149e6..54c49c1 100644
--- a/bootstrap_test.py
+++ b/bootstrap_test.py
@@ -148,8 +148,10 @@ class TestBootstrap(BaseBootstrapTest):
2*streaming_keep_alive_period_in_secs to receive a single sstable
"""
cluster = self.cluster
- cluster.set_configuration_options(values={'streaming_socket_timeout_in_ms': 1000,
- 'streaming_keep_alive_period_in_secs': 2})
+ yaml_opts = {'streaming_keep_alive_period_in_secs': 2}
+ if cluster.version() < '4.0':
+ yamp_opts['streaming_socket_timeout_in_ms'] = 1000
+ cluster.set_configuration_options(values=yaml_opts)
# Create a single node cluster
cluster.populate(1)
@@ -306,7 +308,10 @@ class TestBootstrap(BaseBootstrapTest):
cluster.start(wait_other_notice=True)
# kill stream to node3 in the middle of streaming to let it fail
- node1.byteman_submit(['./byteman/stream_failure.btm'])
+ if cluster.version() < '4.0':
+ node1.byteman_submit(['./byteman/pre4.0/stream_failure.btm'])
+ else:
+ node1.byteman_submit(['./byteman/4.0/stream_failure.btm'])
node1.stress(['write', 'n=1K', 'no-warmup', 'cl=TWO', '-schema', 'replication(factor=2)', '-rate', 'threads=50'])
cluster.flush()
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a0e2660/byteman/4.0/decommission_failure_inject.btm
----------------------------------------------------------------------
diff --git a/byteman/4.0/decommission_failure_inject.btm b/byteman/4.0/decommission_failure_inject.btm
new file mode 100644
index 0000000..a6418fc
--- /dev/null
+++ b/byteman/4.0/decommission_failure_inject.btm
@@ -0,0 +1,17 @@
+#
+# Inject decommission failure to fail streaming from 127.0.0.1
+#
+# Before start streaming files in `StreamSession#onInitializationComplete()` method,
+# interrupt streaming by throwing RuntimeException.
+#
+RULE inject decommission failure
+CLASS org.apache.cassandra.streaming.StreamSession
+METHOD prepareSynAck
+AT INVOKE startStreamingFiles
+BIND peer = $0.peer
+# set flag to only run this rule once.
+IF peer.equals(InetAddress.getByName("127.0.0.1")) AND NOT flagged("done")
+DO
+ flag("done");
+ throw new java.lang.RuntimeException("Triggering network failure")
+ENDRULE
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a0e2660/byteman/4.0/inject_failure_streaming_to_node2.btm
----------------------------------------------------------------------
diff --git a/byteman/4.0/inject_failure_streaming_to_node2.btm b/byteman/4.0/inject_failure_streaming_to_node2.btm
new file mode 100644
index 0000000..761950f
--- /dev/null
+++ b/byteman/4.0/inject_failure_streaming_to_node2.btm
@@ -0,0 +1,17 @@
+#
+# Inject streaming failure
+#
+# Before start streaming files in `StreamSession#prepare()` method,
+# interrupt streaming by throwing RuntimeException.
+#
+RULE inject stream failure
+CLASS org.apache.cassandra.streaming.StreamSession
+METHOD startStreamingFiles
+AT ENTRY
+BIND peer = $0.peer
+# set flag to only run this rule once.
+IF peer.equals(InetAddress.getByName("127.0.0.2")) AND NOT flagged("done")
+DO
+ flag("done");
+ throw new java.lang.RuntimeException("Triggering network failure")
+ENDRULE
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a0e2660/byteman/4.0/stream_failure.btm
----------------------------------------------------------------------
diff --git a/byteman/4.0/stream_failure.btm b/byteman/4.0/stream_failure.btm
new file mode 100644
index 0000000..bf919dd
--- /dev/null
+++ b/byteman/4.0/stream_failure.btm
@@ -0,0 +1,17 @@
+#
+# Inject streaming failure
+#
+# Before start streaming files in `StreamSession#prepare()` method,
+# interrupt streaming by throwing RuntimeException.
+#
+RULE inject stream failure
+CLASS org.apache.cassandra.streaming.StreamSession
+METHOD prepareAck
+AT INVOKE startStreamingFiles
+BIND peer = $0.peer
+# set flag to only run this rule once.
+IF NOT flagged("done")
+DO
+ flag("done");
+ throw new java.lang.RuntimeException("Triggering network failure")
+ENDRULE
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a0e2660/byteman/decommission_failure_inject.btm
----------------------------------------------------------------------
diff --git a/byteman/decommission_failure_inject.btm b/byteman/decommission_failure_inject.btm
deleted file mode 100644
index 32ef6a2..0000000
--- a/byteman/decommission_failure_inject.btm
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Inject decommission failure to fail streaming from 127.0.0.1
-#
-# Before start streaming files in `StreamSession#onInitializationComplete()` method,
-# interrupt streaming by throwing RuntimeException.
-#
-RULE inject decommission failure
-CLASS org.apache.cassandra.streaming.StreamSession
-METHOD onInitializationComplete
-AT INVOKE startStreamingFiles
-BIND peer = $0.peer
-# set flag to only run this rule once.
-IF peer.equals(InetAddress.getByName("127.0.0.1")) AND NOT flagged("done")
-DO
- flag("done");
- throw new java.lang.RuntimeException("Triggering network failure")
-ENDRULE
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a0e2660/byteman/inject_failure_streaming_to_node2.btm
----------------------------------------------------------------------
diff --git a/byteman/inject_failure_streaming_to_node2.btm b/byteman/inject_failure_streaming_to_node2.btm
deleted file mode 100644
index 04f996c..0000000
--- a/byteman/inject_failure_streaming_to_node2.btm
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Inject streaming failure
-#
-# Before start streaming files in `StreamSession#prepare()` method,
-# interrupt streaming by throwing RuntimeException.
-#
-RULE inject stream failure
-CLASS org.apache.cassandra.streaming.StreamSession
-METHOD prepare
-AT INVOKE startStreamingFiles
-BIND peer = $0.peer
-# set flag to only run this rule once.
-IF peer.equals(InetAddress.getByName("127.0.0.2")) AND NOT flagged("done")
-DO
- flag("done");
- throw new java.lang.RuntimeException("Triggering network failure")
-ENDRULE
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a0e2660/byteman/pre4.0/decommission_failure_inject.btm
----------------------------------------------------------------------
diff --git a/byteman/pre4.0/decommission_failure_inject.btm b/byteman/pre4.0/decommission_failure_inject.btm
new file mode 100644
index 0000000..32ef6a2
--- /dev/null
+++ b/byteman/pre4.0/decommission_failure_inject.btm
@@ -0,0 +1,17 @@
+#
+# Inject decommission failure to fail streaming from 127.0.0.1
+#
+# Before start streaming files in `StreamSession#onInitializationComplete()` method,
+# interrupt streaming by throwing RuntimeException.
+#
+RULE inject decommission failure
+CLASS org.apache.cassandra.streaming.StreamSession
+METHOD onInitializationComplete
+AT INVOKE startStreamingFiles
+BIND peer = $0.peer
+# set flag to only run this rule once.
+IF peer.equals(InetAddress.getByName("127.0.0.1")) AND NOT flagged("done")
+DO
+ flag("done");
+ throw new java.lang.RuntimeException("Triggering network failure")
+ENDRULE
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a0e2660/byteman/pre4.0/inject_failure_streaming_to_node2.btm
----------------------------------------------------------------------
diff --git a/byteman/pre4.0/inject_failure_streaming_to_node2.btm b/byteman/pre4.0/inject_failure_streaming_to_node2.btm
new file mode 100644
index 0000000..04f996c
--- /dev/null
+++ b/byteman/pre4.0/inject_failure_streaming_to_node2.btm
@@ -0,0 +1,17 @@
+#
+# Inject streaming failure
+#
+# Before start streaming files in `StreamSession#prepare()` method,
+# interrupt streaming by throwing RuntimeException.
+#
+RULE inject stream failure
+CLASS org.apache.cassandra.streaming.StreamSession
+METHOD prepare
+AT INVOKE startStreamingFiles
+BIND peer = $0.peer
+# set flag to only run this rule once.
+IF peer.equals(InetAddress.getByName("127.0.0.2")) AND NOT flagged("done")
+DO
+ flag("done");
+ throw new java.lang.RuntimeException("Triggering network failure")
+ENDRULE
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a0e2660/byteman/pre4.0/stream_failure.btm
----------------------------------------------------------------------
diff --git a/byteman/pre4.0/stream_failure.btm b/byteman/pre4.0/stream_failure.btm
new file mode 100644
index 0000000..23c63cd
--- /dev/null
+++ b/byteman/pre4.0/stream_failure.btm
@@ -0,0 +1,17 @@
+#
+# Inject streaming failure
+#
+# Before start streaming files in `StreamSession#prepare()` method,
+# interrupt streaming by throwing RuntimeException.
+#
+RULE inject stream failure
+CLASS org.apache.cassandra.streaming.StreamSession
+METHOD prepare
+AT INVOKE startStreamingFiles
+BIND peer = $0.peer
+# set flag to only run this rule once.
+IF NOT flagged("done")
+DO
+ flag("done");
+ throw new java.lang.RuntimeException("Triggering network failure")
+ENDRULE
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a0e2660/byteman/stream_failure.btm
----------------------------------------------------------------------
diff --git a/byteman/stream_failure.btm b/byteman/stream_failure.btm
deleted file mode 100644
index 23c63cd..0000000
--- a/byteman/stream_failure.btm
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Inject streaming failure
-#
-# Before start streaming files in `StreamSession#prepare()` method,
-# interrupt streaming by throwing RuntimeException.
-#
-RULE inject stream failure
-CLASS org.apache.cassandra.streaming.StreamSession
-METHOD prepare
-AT INVOKE startStreamingFiles
-BIND peer = $0.peer
-# set flag to only run this rule once.
-IF NOT flagged("done")
-DO
- flag("done");
- throw new java.lang.RuntimeException("Triggering network failure")
-ENDRULE
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a0e2660/native_transport_ssl_test.py
----------------------------------------------------------------------
diff --git a/native_transport_ssl_test.py b/native_transport_ssl_test.py
index 67dcfaf..4716c80 100644
--- a/native_transport_ssl_test.py
+++ b/native_transport_ssl_test.py
@@ -30,7 +30,7 @@ class NativeTransportSSL(Tester):
except NoHostAvailable:
pass
- self.assertGreater(len(node1.grep_log("^io.netty.handler.ssl.NotSslRecordException.*")), 0, "Missing SSL handshake exception while connecting with non-SSL enabled client")
+ self.assertGreater(len(node1.grep_log("io.netty.handler.ssl.NotSslRecordException.*")), 0, "Missing SSL handshake exception while connecting with non-SSL enabled client")
# enabled ssl on the client and try again (this should work)
session = self.patient_cql_connection(node1, ssl_opts={'ca_certs': os.path.join(self.test_path, 'ccm_node.cer')})
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a0e2660/nodetool_test.py
----------------------------------------------------------------------
diff --git a/nodetool_test.py b/nodetool_test.py
index d7ce89a..8d5c776 100644
--- a/nodetool_test.py
+++ b/nodetool_test.py
@@ -71,9 +71,11 @@ class TestNodetool(Tester):
cluster.populate([1]).start()
node = cluster.nodelist()[0]
- types = ('read', 'range', 'write', 'counterwrite', 'cascontention',
- 'truncate', 'streamingsocket', 'misc')
-
+ types = ['read', 'range', 'write', 'counterwrite', 'cascontention',
+ 'truncate', 'misc']
+ if cluster.version() < '4.0':
+ types.append('streamingsocket')
+
# read all of the timeouts, make sure we get a sane response
for timeout_type in types:
out, err, _ = node.nodetool('gettimeout {}'.format(timeout_type))
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a0e2660/rebuild_test.py
----------------------------------------------------------------------
diff --git a/rebuild_test.py b/rebuild_test.py
index 13d96ba..273a749 100644
--- a/rebuild_test.py
+++ b/rebuild_test.py
@@ -194,7 +194,10 @@ class TestRebuild(Tester):
session.execute("ALTER KEYSPACE system_auth WITH REPLICATION = {'class':'NetworkTopologyStrategy', 'dc1':1, 'dc2':1};")
# Path to byteman script which makes the streaming to node2 throw an exception, making rebuild fail
- script = ['./byteman/inject_failure_streaming_to_node2.btm']
+ if cluster.version() < '4.0':
+ script = ['./byteman/pre4.0/inject_failure_streaming_to_node2.btm']
+ else:
+ script = ['./byteman/4.0/inject_failure_streaming_to_node2.btm']
node3.byteman_submit(script)
# First rebuild must fail and data must be incomplete
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a0e2660/replace_address_test.py
----------------------------------------------------------------------
diff --git a/replace_address_test.py b/replace_address_test.py
index 1da911f..f80af17 100644
--- a/replace_address_test.py
+++ b/replace_address_test.py
@@ -445,10 +445,14 @@ class TestReplaceAddress(BaseReplaceAddressTest):
self._stop_node_to_replace()
debug("Submitting byteman script to make stream fail")
- self.query_node.byteman_submit(['./byteman/stream_failure.btm'])
- self._do_replace(jvm_option='replace_address_first_boot',
- opts={'streaming_socket_timeout_in_ms': 1000})
+ if self.cluster.version() < '4.0':
+ self.query_node.byteman_submit(['./byteman/pre4.0/stream_failure.btm'])
+ self._do_replace(jvm_option='replace_address_first_boot',
+ opts={'streaming_socket_timeout_in_ms': 1000})
+ else:
+ self.query_node.byteman_submit(['./byteman/4.0/stream_failure.btm'])
+ self._do_replace(jvm_option='replace_address_first_boot')
# Make sure bootstrap did not complete successfully
assert_bootstrap_state(self, self.replacement_node, 'IN_PROGRESS')
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a0e2660/secondary_indexes_test.py
----------------------------------------------------------------------
diff --git a/secondary_indexes_test.py b/secondary_indexes_test.py
index 11cd3af..a7580c2 100644
--- a/secondary_indexes_test.py
+++ b/secondary_indexes_test.py
@@ -1190,10 +1190,19 @@ class TestPreJoinCallback(Tester):
node1.byteman_port = '8100'
node1.import_config_files()
node1.start(wait_for_binary_proto=True)
- node1.byteman_submit(['./byteman/inject_failure_streaming_to_node2.btm'])
+
+ if cluster.version() < '4.0':
+ node1.byteman_submit(['./byteman/pre4.0/inject_failure_streaming_to_node2.btm'])
+ else:
+ node1.byteman_submit(['./byteman/4.0/inject_failure_streaming_to_node2.btm'])
node2 = new_node(cluster)
- node2.set_configuration_options(values={'initial_token': token, 'streaming_socket_timeout_in_ms': 1000})
+
+ yaml_opts = {'initial_token': token}
+ if cluster.version() < '4.0':
+ yaml_opts['streaming_socket_timeout_in_ms'] = 1000
+
+ node2.set_configuration_options(values=yaml_opts)
node2.start(wait_other_notice=False, wait_for_binary_proto=True)
assert_bootstrap_state(self, node2, 'IN_PROGRESS')
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a0e2660/sslnodetonode_test.py
----------------------------------------------------------------------
diff --git a/sslnodetonode_test.py b/sslnodetonode_test.py
index a11a3f4..a675985 100644
--- a/sslnodetonode_test.py
+++ b/sslnodetonode_test.py
@@ -7,11 +7,10 @@ from dtest import Tester
from tools import sslkeygen
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$"
-
+# as the error message logged will be different per netty ssl implementation (jdk vs openssl (libre vs boring vs ...)),
+# the best we can do is just look for a SSLHandshakeException
+_LOG_ERR_HANDSHAKE = "javax.net.ssl.SSLHandshakeException"
+_LOG_ERR_GENERAL = "javax.net.ssl.SSLException"
@since('3.6')
class TestNodeToNodeSSLEncryption(Tester):
@@ -60,10 +59,10 @@ class TestNodeToNodeSSLEncryption(Tester):
self.allow_log_errors = True
self.cluster.start(no_wait=True)
- found = self._grep_msg(self.node1, _LOG_ERR_IP, _LOG_ERR_HOST)
+ found = self._grep_msg(self.node1, _LOG_ERR_HANDSHAKE, _LOG_ERR_GENERAL)
self.assertTrue(found)
- found = self._grep_msg(self.node2, _LOG_ERR_IP, _LOG_ERR_HOST)
+ found = self._grep_msg(self.node2, _LOG_ERR_HANDSHAKE, _LOG_ERR_GENERAL)
self.assertTrue(found)
self.cluster.stop()
@@ -81,10 +80,10 @@ class TestNodeToNodeSSLEncryption(Tester):
self.cluster.start(no_wait=True)
time.sleep(2)
- found = self._grep_msg(self.node1, _LOG_ERR_CERT)
+ found = self._grep_msg(self.node1, _LOG_ERR_HANDSHAKE, _LOG_ERR_GENERAL)
self.assertTrue(found)
- found = self._grep_msg(self.node2, _LOG_ERR_CERT)
+ found = self._grep_msg(self.node2, _LOG_ERR_HANDSHAKE, _LOG_ERR_GENERAL)
self.assertTrue(found)
self.cluster.stop()
@@ -114,7 +113,7 @@ class TestNodeToNodeSSLEncryption(Tester):
self.allow_log_errors = True
self.cluster.start(no_wait=True)
- found = self._grep_msg(self.node1, _LOG_ERR_SIG)
+ found = self._grep_msg(self.node1, _LOG_ERR_HANDSHAKE)
self.cluster.stop()
self.assertTrue(found)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a0e2660/topology_test.py
----------------------------------------------------------------------
diff --git a/topology_test.py b/topology_test.py
index 45c1c73..797eca3 100644
--- a/topology_test.py
+++ b/topology_test.py
@@ -212,7 +212,10 @@ class TestTopology(Tester):
# Execute first rebuild, should fail
with self.assertRaises(ToolError):
- script = ['./byteman/decommission_failure_inject.btm']
+ if cluster.version() >= '4.0':
+ script = ['./byteman/4.0/decommission_failure_inject.btm']
+ else:
+ script = ['./byteman/pre4.0/decommission_failure_inject.btm']
node2.byteman_submit(script)
node2.nodetool('decommission')
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[48/50] cassandra git commit: Fix short read protection
Posted by pa...@apache.org.
Fix short read protection
patch by Aleksey Yeschenko; reviewed by Benedict Elliott Smith for
CASSANDRA-13747
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2ad557df
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2ad557df
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2ad557df
Branch: refs/heads/master
Commit: 2ad557dff9f9d4a3c09f0781b3eeeb5fe75b57d0
Parents: ac9c956
Author: Aleksey Yeschenko <al...@yeschenko.com>
Authored: Mon Aug 7 14:06:05 2017 +0100
Committer: Aleksey Yeschenko <al...@yeschenko.com>
Committed: Tue Aug 29 12:47:10 2017 +0100
----------------------------------------------------------------------
consistency_test.py | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2ad557df/consistency_test.py
----------------------------------------------------------------------
diff --git a/consistency_test.py b/consistency_test.py
index 9424b4c..b50d81b 100644
--- a/consistency_test.py
+++ b/consistency_test.py
@@ -772,6 +772,59 @@ class TestAccuracy(TestHelper):
class TestConsistency(Tester):
+ @since('3.0')
+ def test_13747(self):
+ """
+ @jira_ticket CASSANDRA-13747
+ """
+ cluster = self.cluster
+
+ # disable hinted handoff and set batch commit log so this doesn't interfere with the test
+ cluster.set_configuration_options(values={'hinted_handoff_enabled': False})
+ cluster.set_batch_commitlog(enabled=True)
+
+ cluster.populate(2).start(wait_other_notice=True)
+ node1, node2 = cluster.nodelist()
+
+ session = self.patient_cql_connection(node1)
+
+ query = "CREATE KEYSPACE IF NOT EXISTS test WITH replication = {'class': 'NetworkTopologyStrategy', 'datacenter1': 2};"
+ session.execute(query)
+
+ query = "CREATE TABLE IF NOT EXISTS test.test (id int PRIMARY KEY);"
+ session.execute(query)
+
+ #
+ # populate the table with 10 rows:
+ #
+
+ # -7509452495886106294 | 5
+ # -4069959284402364209 | 1 x
+ # -3799847372828181882 | 8
+ # -3485513579396041028 | 0 x
+ # -3248873570005575792 | 2
+ # -2729420104000364805 | 4 x
+ # 1634052884888577606 | 7
+ # 2705480034054113608 | 6 x
+ # 3728482343045213994 | 9
+ # 9010454139840013625 | 3 x
+
+ stmt = session.prepare("INSERT INTO test.test (id) VALUES (?);")
+ for id in range(0, 10):
+ session.execute(stmt, [id], ConsistencyLevel.ALL)
+
+ # with node2 down and hints disabled, delete every other row on node1
+ node2.stop(wait_other_notice=True)
+ session.execute("DELETE FROM test.test WHERE id IN (1, 0, 4, 6, 3);")
+
+ # with both nodes up, do a DISTINCT range query with CL.ALL;
+ # prior to CASSANDRA-13747 this would cause an assertion in short read protection code
+ node2.start(wait_other_notice=True)
+ stmt = SimpleStatement("SELECT DISTINCT token(id), id FROM test.test;",
+ consistency_level = ConsistencyLevel.ALL)
+ result = list(session.execute(stmt))
+ assert_length_equal(result, 5)
+
def short_read_test(self):
"""
@jira_ticket CASSANDRA-9460
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[35/50] cassandra git commit: Added test to verify indexes are not
rebuilt at startup if not actually needed.
Posted by pa...@apache.org.
Added test to verify indexes are not rebuilt at startup if not actually needed.
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b724df80
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b724df80
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b724df80
Branch: refs/heads/master
Commit: b724df80d3bbb55b6b41845633e3a9034116f3be
Parents: 894bc92
Author: Sergio Bossa <se...@gmail.com>
Authored: Mon Jul 24 14:08:32 2017 +0100
Committer: Sergio Bossa <se...@gmail.com>
Committed: Tue Jul 25 18:47:50 2017 +0100
----------------------------------------------------------------------
secondary_indexes_test.py | 69 ++++++++++++------------------------------
tools/data.py | 18 ++++++++++-
2 files changed, 37 insertions(+), 50 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b724df80/secondary_indexes_test.py
----------------------------------------------------------------------
diff --git a/secondary_indexes_test.py b/secondary_indexes_test.py
index 1edd30e..11cd3af 100644
--- a/secondary_indexes_test.py
+++ b/secondary_indexes_test.py
@@ -14,11 +14,10 @@ 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_none, assert_one, assert_row_count
-from tools.data import index_is_built, rows_to_list
+from tools.data import block_until_index_is_built, index_is_built, rows_to_list
from tools.decorators import since
from tools.misc import new_node
-
class TestSecondaryIndexes(Tester):
@staticmethod
@@ -306,28 +305,14 @@ class TestSecondaryIndexes(Tester):
lookup_value = session.execute('select "C0" from standard1 limit 1')[0].C0
session.execute('CREATE INDEX ix_c0 ON standard1("C0");')
- start = time.time()
- while time.time() < start + 30:
- debug("waiting for index to build")
- time.sleep(1)
- if index_is_built(node1, session, 'keyspace1', 'standard1', 'ix_c0'):
- break
- else:
- raise DtestTimeoutError()
+ block_until_index_is_built(node1, session, 'keyspace1', 'standard1', 'ix_c0')
stmt = session.prepare('select * from standard1 where "C0" = ?')
self.assertEqual(1, len(list(session.execute(stmt, [lookup_value]))))
before_files = self._index_sstables_files(node1, 'keyspace1', 'standard1', 'ix_c0')
node1.nodetool("rebuild_index keyspace1 standard1 ix_c0")
- start = time.time()
- while time.time() < start + 30:
- debug("waiting for index to rebuild")
- time.sleep(1)
- if index_is_built(node1, session, 'keyspace1', 'standard1', 'ix_c0'):
- break
- else:
- raise DtestTimeoutError()
+ block_until_index_is_built(node1, session, 'keyspace1', 'standard1', 'ix_c0')
after_files = self._index_sstables_files(node1, 'keyspace1', 'standard1', 'ix_c0')
self.assertNotEqual(before_files, after_files)
@@ -447,39 +432,39 @@ class TestSecondaryIndexes(Tester):
'Cannot execute this query as it might involve data filtering')
@since('4.0')
- def test_index_is_not_always_rebuilt_at_start(self):
+ def test_index_is_not_rebuilt_at_restart(self):
"""
- @jira_ticket CASSANDRA-10130
+ @jira_ticket CASSANDRA-13725
- Tests the management of index status during manual index rebuilding failures.
+ Tests the index is not rebuilt at restart if already built.
"""
cluster = self.cluster
- cluster.populate(1, install_byteman=True).start(wait_for_binary_proto=True)
+ cluster.populate(1).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
+ debug("Create the index")
+ session.execute("CREATE INDEX idx ON k.t(v)")
+ block_until_index_is_built(node, session, 'k', 't', 'idx')
+ before_files = self._index_sstables_files(node, 'k', 't', 'idx')
+
+ debug("Verify the index is marked as built and it can be queried")
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')
+ debug("Restart the node and verify the index build is not submitted")
node.stop()
- cluster.start()
- session = self.patient_cql_connection(node)
- session.execute("USE k")
+ node.start(wait_for_binary_proto=True)
after_files = self._index_sstables_files(node, 'k', 't', 'idx')
+ self.assertEqual(before_files, after_files)
- # Verify that, the index is not rebuilt, marked as built, and it can answer queries
- self.assertNotEqual(before_files, after_files)
+ debug("Verify the index is still marked as built and it can be queried")
+ session = self.patient_cql_connection(node)
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])
@@ -610,14 +595,7 @@ class TestSecondaryIndexes(Tester):
session.execute("CREATE INDEX composites_index on ks.regular_table (b)")
for node in cluster.nodelist():
- start = time.time()
- while time.time() < start + 10:
- debug("waiting for index to build")
- time.sleep(1)
- if index_is_built(node, session, 'ks', 'regular_table', 'composites_index'):
- break
- else:
- raise DtestTimeoutError()
+ block_until_index_is_built(node, session, 'ks', 'regular_table', 'composites_index')
insert_args = [(i, i % 2) for i in xrange(100)]
execute_concurrent_with_args(session,
@@ -1067,14 +1045,7 @@ class TestSecondaryIndexesOnCollections(Tester):
stmt = "CREATE INDEX user_uuids_values on map_index_search.users (uuids);"
session.execute(stmt)
- start = time.time()
- while time.time() < start + 30:
- debug("waiting for index to build")
- time.sleep(1)
- if index_is_built(node1, session, 'map_index_search', 'users', 'user_uuids_values'):
- break
- else:
- raise DtestTimeoutError()
+ block_until_index_is_built(node1, session, 'map_index_search', 'users', 'user_uuids_values')
# shuffle the log in-place, and double-check a slice of records by querying the secondary index
random.shuffle(log)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b724df80/tools/data.py
----------------------------------------------------------------------
diff --git a/tools/data.py b/tools/data.py
index e1a3cfc..597a10c 100644
--- a/tools/data.py
+++ b/tools/data.py
@@ -6,7 +6,8 @@ from cassandra.query import SimpleStatement
from nose.tools import assert_equal, assert_true
import assertions
-from dtest import create_cf
+from dtest import debug, create_cf, DtestTimeoutError
+from tools.funcutils import get_rate_limited_function
def create_c1c2_table(tester, session, read_repair=None):
@@ -149,3 +150,18 @@ def index_is_built(node, session, keyspace, table_name, idx_name):
full_idx_name = idx_name if node.get_cassandra_version() > '3.0' else '{}.{}'.format(table_name, idx_name)
index_query = """SELECT * FROM system."IndexInfo" WHERE table_name = '{}' AND index_name = '{}'""".format(keyspace, full_idx_name)
return len(list(session.execute(index_query))) == 1
+
+def block_until_index_is_built(node, session, keyspace, table_name, idx_name):
+ """
+ Waits up to 30 seconds for a secondary index to be built, and raises
+ DtestTimeoutError if it is not.
+ """
+ start = time.time()
+ rate_limited_debug = get_rate_limited_function(debug, 5)
+ while time.time() < start + 30:
+ rate_limited_debug("waiting for index to build")
+ time.sleep(1)
+ if index_is_built(node, session, keyspace, table_name, idx_name):
+ break
+ else:
+ raise DtestTimeoutError()
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[16/50] cassandra git commit: Merge pull request #1477 from
stef1927/13559
Posted by pa...@apache.org.
Merge pull request #1477 from stef1927/13559
Test for CASSANDRA-13559
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ef84f767
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ef84f767
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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
[50/50] cassandra git commit: CASSANDRA-11500: add dtest for complex
update/delete tombstones in MV
Posted by pa...@apache.org.
CASSANDRA-11500: add dtest for complex update/delete tombstones in MV
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6d77ace5
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6d77ace5
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6d77ace5
Branch: refs/heads/master
Commit: 6d77ace5361f020ba182072ade9f4ab98025c213
Parents: 19b6613
Author: Zhao Yang <zh...@gmail.com>
Authored: Mon May 1 23:24:12 2017 +0800
Committer: Paulo Motta <pa...@apache.org>
Committed: Tue Sep 5 00:39:48 2017 -0500
----------------------------------------------------------------------
materialized_views_test.py | 308 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 307 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6d77ace5/materialized_views_test.py
----------------------------------------------------------------------
diff --git a/materialized_views_test.py b/materialized_views_test.py
index 574d90f..637124d 100644
--- a/materialized_views_test.py
+++ b/materialized_views_test.py
@@ -66,6 +66,14 @@ class TestMaterializedViews(Tester):
return session
+ def update_view(self, session, query, flush, compact=False):
+ session.execute(query)
+ self._replay_batchlogs()
+ if flush:
+ self.cluster.flush()
+ if compact:
+ self.cluster.compact()
+
def _settle_nodes(self):
debug("Settling all nodes")
stage_match = re.compile("(?P<name>\S+)\s+(?P<active>\d+)\s+(?P<pending>\d+)\s+(?P<completed>\d+)\s+(?P<blocked>\d+)\s+(?P<alltimeblocked>\d+)")
@@ -334,7 +342,7 @@ class TestMaterializedViews(Tester):
assert_invalid(
session,
"ALTER TABLE ks.users DROP state;",
- "Cannot drop column state, depended on by materialized views"
+ "Cannot drop column state on base table with materialized views."
)
def drop_table_test(self):
@@ -974,6 +982,304 @@ class TestMaterializedViews(Tester):
cl=ConsistencyLevel.ALL
)
+ @since('3.0')
+ def test_no_base_column_in_view_pk_complex_timestamp_with_flush(self):
+ self._test_no_base_column_in_view_pk_complex_timestamp(flush=True)
+
+ @since('3.0')
+ def test_no_base_column_in_view_pk_complex_timestamp_without_flush(self):
+ self._test_no_base_column_in_view_pk_complex_timestamp(flush=False)
+
+ def _test_no_base_column_in_view_pk_complex_timestamp(self, flush):
+ """
+ Able to shadow old view row if all columns in base are removed including unselected
+ Able to recreate view row if at least one selected column alive
+
+ @jira_ticket CASSANDRA-11500
+ """
+ session = self.prepare(rf=3, nodes=3, options={'hinted_handoff_enabled': False}, consistency_level=ConsistencyLevel.QUORUM)
+ node1, node2, node3 = self.cluster.nodelist()
+
+ session.execute('USE ks')
+ session.execute("CREATE TABLE t (k int, c int, a int, b int, e int, f int, primary key(k, c))")
+ session.execute(("CREATE MATERIALIZED VIEW mv AS SELECT k,c,a,b FROM t "
+ "WHERE k IS NOT NULL AND c IS NOT NULL PRIMARY KEY (c, k)"))
+ session.cluster.control_connection.wait_for_schema_agreement()
+
+ # update unselected, view row should be alive
+ self.update_view(session, "UPDATE t USING TIMESTAMP 1 SET e=1 WHERE k=1 AND c=1;", flush)
+ assert_one(session, "SELECT * FROM t", [1, 1, None, None, 1, None])
+ assert_one(session, "SELECT * FROM mv", [1, 1, None, None])
+
+ # remove unselected, add selected column, view row should be alive
+ self.update_view(session, "UPDATE t USING TIMESTAMP 2 SET e=null, b=1 WHERE k=1 AND c=1;", flush)
+ assert_one(session, "SELECT * FROM t", [1, 1, None, 1, None, None])
+ assert_one(session, "SELECT * FROM mv", [1, 1, None, 1])
+
+ # remove selected column, view row is removed
+ self.update_view(session, "UPDATE t USING TIMESTAMP 2 SET e=null, b=null WHERE k=1 AND c=1;", flush)
+ assert_none(session, "SELECT * FROM t")
+ assert_none(session, "SELECT * FROM mv")
+
+ # update unselected with ts=3, view row should be alive
+ self.update_view(session, "UPDATE t USING TIMESTAMP 3 SET f=1 WHERE k=1 AND c=1;", flush)
+ assert_one(session, "SELECT * FROM t", [1, 1, None, None, None, 1])
+ assert_one(session, "SELECT * FROM mv", [1, 1, None, None])
+
+ # insert livenesssInfo, view row should be alive
+ self.update_view(session, "INSERT INTO t(k,c) VALUES(1,1) USING TIMESTAMP 3", flush)
+ assert_one(session, "SELECT * FROM t", [1, 1, None, None, None, 1])
+ assert_one(session, "SELECT * FROM mv", [1, 1, None, None])
+
+ # remove unselected, view row should be alive because of base livenessInfo alive
+ self.update_view(session, "UPDATE t USING TIMESTAMP 3 SET f=null WHERE k=1 AND c=1;", flush)
+ assert_one(session, "SELECT * FROM t", [1, 1, None, None, None, None])
+ assert_one(session, "SELECT * FROM mv", [1, 1, None, None])
+
+ # add selected column, view row should be alive
+ self.update_view(session, "UPDATE t USING TIMESTAMP 3 SET a=1 WHERE k=1 AND c=1;", flush)
+ assert_one(session, "SELECT * FROM t", [1, 1, 1, None, None, None])
+ assert_one(session, "SELECT * FROM mv", [1, 1, 1, None])
+
+ # update unselected, view row should be alive
+ self.update_view(session, "UPDATE t USING TIMESTAMP 4 SET f=1 WHERE k=1 AND c=1;", flush)
+ assert_one(session, "SELECT * FROM t", [1, 1, 1, None, None, 1])
+ assert_one(session, "SELECT * FROM mv", [1, 1, 1, None])
+
+ # delete with ts=3, view row should be alive due to unselected@ts4
+ self.update_view(session, "DELETE FROM t USING TIMESTAMP 3 WHERE k=1 AND c=1;", flush)
+ assert_one(session, "SELECT * FROM t", [1, 1, None, None, None, 1])
+ assert_one(session, "SELECT * FROM mv", [1, 1, None, None])
+
+ # remove unselected, view row should be removed
+ self.update_view(session, "UPDATE t USING TIMESTAMP 4 SET f=null WHERE k=1 AND c=1;", flush)
+ assert_none(session, "SELECT * FROM t")
+ assert_none(session, "SELECT * FROM mv")
+
+ # add selected with ts=7, view row is alive
+ self.update_view(session, "UPDATE t USING TIMESTAMP 7 SET b=1 WHERE k=1 AND c=1;", flush)
+ assert_one(session, "SELECT * FROM t", [1, 1, None, 1, None, None])
+ assert_one(session, "SELECT * FROM mv", [1, 1, None, 1])
+
+ # remove selected with ts=7, view row is dead
+ self.update_view(session, "UPDATE t USING TIMESTAMP 7 SET b=null WHERE k=1 AND c=1;", flush)
+ assert_none(session, "SELECT * FROM t")
+ assert_none(session, "SELECT * FROM mv")
+
+ # add selected with ts=5, view row is alive (selected column should not affects each other)
+ self.update_view(session, "UPDATE t USING TIMESTAMP 5 SET a=1 WHERE k=1 AND c=1;", flush)
+ assert_one(session, "SELECT * FROM t", [1, 1, 1, None, None, None])
+ assert_one(session, "SELECT * FROM mv", [1, 1, 1, None])
+
+ # add selected with ttl=5
+ self.update_view(session, "UPDATE t USING TTL 10 SET a=1 WHERE k=1 AND c=1;", flush)
+ assert_one(session, "SELECT * FROM t", [1, 1, 1, None, None, None])
+ assert_one(session, "SELECT * FROM mv", [1, 1, 1, None])
+
+ time.sleep(10)
+
+ # update unselected with ttl=10, view row should be alive
+ self.update_view(session, "UPDATE t USING TTL 10 SET f=1 WHERE k=1 AND c=1;", flush)
+ assert_one(session, "SELECT * FROM t", [1, 1, None, None, None, 1])
+ assert_one(session, "SELECT * FROM mv", [1, 1, None, None])
+
+ time.sleep(10)
+
+ # view row still alive due to base livenessInfo
+ assert_none(session, "SELECT * FROM t")
+ assert_none(session, "SELECT * FROM mv")
+
+ @since('3.0')
+ def test_base_column_in_view_pk_complex_timestamp_with_flush(self):
+ self._test_base_column_in_view_pk_complex_timestamp(flush=True)
+
+ @since('3.0')
+ def test_base_column_in_view_pk_complex_timestamp_without_flush(self):
+ self._test_base_column_in_view_pk_complex_timestamp(flush=False)
+
+ def _test_base_column_in_view_pk_complex_timestamp(self, flush):
+ """
+ Able to shadow old view row with column ts greater than pk's ts and re-insert the view row
+ Able to shadow old view row with column ts smaller than pk's ts and re-insert the view row
+
+ @jira_ticket CASSANDRA-11500
+ """
+ session = self.prepare(rf=3, nodes=3, options={'hinted_handoff_enabled': False}, consistency_level=ConsistencyLevel.QUORUM)
+ node1, node2, node3 = self.cluster.nodelist()
+
+ session.execute('USE ks')
+ session.execute("CREATE TABLE t (k int PRIMARY KEY, a int, b int)")
+ session.execute(("CREATE MATERIALIZED VIEW mv AS SELECT * FROM t "
+ "WHERE k IS NOT NULL AND a IS NOT NULL PRIMARY KEY (k, a)"))
+ session.cluster.control_connection.wait_for_schema_agreement()
+
+ # Set initial values TS=1
+ self.update_view(session, "INSERT INTO t (k, a, b) VALUES (1, 1, 1) USING TIMESTAMP 1;", flush)
+ assert_one(session, "SELECT * FROM t", [1, 1, 1])
+ assert_one(session, "SELECT * FROM mv", [1, 1, 1])
+
+ # increase b ts to 10
+ self.update_view(session, "UPDATE t USING TIMESTAMP 10 SET b = 2 WHERE k = 1;", flush)
+ assert_one(session, "SELECT k,a,b,writetime(b) FROM t", [1, 1, 2, 10])
+ assert_one(session, "SELECT k,a,b,writetime(b) FROM mv", [1, 1, 2, 10])
+
+ # switch entries. shadow a = 1, insert a = 2
+ self.update_view(session, "UPDATE t USING TIMESTAMP 2 SET a = 2 WHERE k = 1;", flush)
+ assert_one(session, "SELECT k,a,b,writetime(b) FROM t", [1, 2, 2, 10])
+ assert_one(session, "SELECT k,a,b,writetime(b) FROM mv", [1, 2, 2, 10])
+
+ # switch entries. shadow a = 2, insert a = 1
+ self.update_view(session, "UPDATE t USING TIMESTAMP 3 SET a = 1 WHERE k = 1;", flush)
+ assert_one(session, "SELECT k,a,b,writetime(b) FROM t", [1, 1, 2, 10])
+ assert_one(session, "SELECT k,a,b,writetime(b) FROM mv", [1, 1, 2, 10])
+
+ # switch entries. shadow a = 1, insert a = 2
+ self.update_view(session, "UPDATE t USING TIMESTAMP 4 SET a = 2 WHERE k = 1;", flush, compact=True)
+ assert_one(session, "SELECT k,a,b,writetime(b) FROM t", [1, 2, 2, 10])
+ assert_one(session, "SELECT k,a,b,writetime(b) FROM mv", [1, 2, 2, 10])
+
+ # able to shadow view row even if base-column in view pk's ts is smaller than row timestamp
+ # set row TS = 20, a@6, b@20
+ self.update_view(session, "DELETE FROM t USING TIMESTAMP 5 where k = 1;", flush)
+ assert_one(session, "SELECT k,a,b,writetime(b) FROM t", [1, None, 2, 10])
+ assert_none(session, "SELECT k,a,b,writetime(b) FROM mv")
+ self.update_view(session, "INSERT INTO t (k, a, b) VALUES (1, 1, 1) USING TIMESTAMP 6;", flush)
+ assert_one(session, "SELECT k,a,b,writetime(b) FROM t", [1, 1, 2, 10])
+ assert_one(session, "SELECT k,a,b,writetime(b) FROM mv", [1, 1, 2, 10])
+ self.update_view(session, "INSERT INTO t (k, b) VALUES (1, 1) USING TIMESTAMP 20;", flush)
+ assert_one(session, "SELECT k,a,b,writetime(b) FROM t", [1, 1, 1, 20])
+ assert_one(session, "SELECT k,a,b,writetime(b) FROM mv", [1, 1, 1, 20])
+
+ # switch entries. shadow a = 1, insert a = 2
+ self.update_view(session, "UPDATE t USING TIMESTAMP 7 SET a = 2 WHERE k = 1;", flush)
+ assert_one(session, "SELECT k,a,b,writetime(a),writetime(b) FROM t", [1, 2, 1, 7, 20])
+ assert_one(session, "SELECT k,a,b,writetime(b) FROM mv", [1, 2, 1, 20])
+
+ # switch entries. shadow a = 2, insert a = 1
+ self.update_view(session, "UPDATE t USING TIMESTAMP 8 SET a = 1 WHERE k = 1;", flush)
+ assert_one(session, "SELECT k,a,b,writetime(a),writetime(b) FROM t", [1, 1, 1, 8, 20])
+ assert_one(session, "SELECT k,a,b,writetime(b) FROM mv", [1, 1, 1, 20])
+
+ # create another view row
+ self.update_view(session, "INSERT INTO t (k, a, b) VALUES (2, 2, 2);", flush)
+ assert_one(session, "SELECT k,a,b FROM t WHERE k = 2", [2, 2, 2])
+ assert_one(session, "SELECT k,a,b FROM mv WHERE k = 2", [2, 2, 2])
+
+ # stop node2, node3
+ debug('Shutdown node2')
+ node2.stop(wait_other_notice=True)
+ debug('Shutdown node3')
+ node3.stop(wait_other_notice=True)
+ # shadow a = 1, create a = 2
+ query = SimpleStatement("UPDATE t USING TIMESTAMP 9 SET a = 2 WHERE k = 1", consistency_level=ConsistencyLevel.ONE)
+ self.update_view(session, query, flush)
+ # shadow (a=2, k=2) after 3 second
+ query = SimpleStatement("UPDATE t USING TTL 3 SET a = 2 WHERE k = 2", consistency_level=ConsistencyLevel.ONE)
+ self.update_view(session, query, flush)
+
+ debug('Starting node2')
+ node2.start(wait_other_notice=True)
+ debug('Starting node3')
+ node3.start(wait_other_notice=True)
+
+ # For k = 1 & a = 1, We should get a digest mismatch of tombstones and repaired
+ query = SimpleStatement("SELECT * FROM mv WHERE k = 1 AND a = 1", consistency_level=ConsistencyLevel.ALL)
+ result = session.execute(query, trace=True)
+ self.check_trace_events(result.get_query_trace(), True)
+ self.assertEqual(0, len(result.current_rows))
+
+ # For k = 1 & a = 1, second time no digest mismatch
+ result = session.execute(query, trace=True)
+ self.check_trace_events(result.get_query_trace(), False)
+ assert_none(session, "SELECT * FROM mv WHERE k = 1 AND a = 1")
+ self.assertEqual(0, len(result.current_rows))
+
+ # For k = 1 & a = 2, We should get a digest mismatch of data and repaired for a = 2
+ query = SimpleStatement("SELECT * FROM mv WHERE k = 1 AND a = 2", consistency_level=ConsistencyLevel.ALL)
+ result = session.execute(query, trace=True)
+ self.check_trace_events(result.get_query_trace(), True)
+ self.assertEqual(1, len(result.current_rows))
+
+ # For k = 1 & a = 2, second time no digest mismatch
+ result = session.execute(query, trace=True)
+ self.check_trace_events(result.get_query_trace(), False)
+ self.assertEqual(1, len(result.current_rows))
+ assert_one(session, "SELECT k,a,b,writetime(b) FROM mv WHERE k = 1", [1, 2, 1, 20])
+
+ time.sleep(3)
+ # For k = 2 & a = 2, We should get a digest mismatch of expired and repaired
+ query = SimpleStatement("SELECT * FROM mv WHERE k = 2 AND a = 2", consistency_level=ConsistencyLevel.ALL)
+ result = session.execute(query, trace=True)
+ self.check_trace_events(result.get_query_trace(), True)
+ debug(result.current_rows)
+ self.assertEqual(0, len(result.current_rows))
+
+ # For k = 2 & a = 2, second time no digest mismatch
+ result = session.execute(query, trace=True)
+ self.check_trace_events(result.get_query_trace(), False)
+ self.assertEqual(0, len(result.current_rows))
+
+ @since('4.0')
+ def test_base_column_in_view_pk_commutative_tombstone_with_flush(self):
+ self._test_base_column_in_view_pk_commutative_tombstone_(flush=True)
+
+ @since('4.0')
+ def test_base_column_in_view_pk_commutative_tombstone_without_flush(self):
+ self._test_base_column_in_view_pk_commutative_tombstone_(flush=False)
+
+ def _test_base_column_in_view_pk_commutative_tombstone_(self, flush):
+ """
+ view row deletion should be commutative with newer view livenessInfo, otherwise deleted columns may be resurrected.
+ @jira_ticket CASSANDRA-13409
+ """
+ session = self.prepare(rf=3, nodes=3, options={'hinted_handoff_enabled': False}, consistency_level=ConsistencyLevel.QUORUM)
+ node1 = self.cluster.nodelist()[0]
+
+ session.execute('USE ks')
+ session.execute("CREATE TABLE t (id int PRIMARY KEY, v int, v2 text, v3 decimal)")
+ 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)"))
+ session.cluster.control_connection.wait_for_schema_agreement()
+ for node in self.cluster.nodelist():
+ node.nodetool("disableautocompaction")
+
+ # sstable 1, Set initial values TS=1
+ self.update_view(session, "INSERT INTO t (id, v, v2, v3) VALUES (1, 1, 'a', 3.0) USING TIMESTAMP 1", flush)
+ assert_one(session, "SELECT * FROM t_by_v", [1, 1, 'a', 3.0])
+
+ # sstable 2, change v's value and TS=2, tombstones v=1 and adds v=0 record
+ self.update_view(session, "DELETE FROM t USING TIMESTAMP 2 WHERE id = 1;", flush)
+ assert_none(session, "SELECT * FROM t_by_v")
+ assert_none(session, "SELECT * FROM t")
+
+ # sstable 3, tombstones of mv created by base deletion should remain.
+ self.update_view(session, "INSERT INTO t (id, v) VALUES (1, 1) USING TIMESTAMP 3", flush)
+ assert_one(session, "SELECT * FROM t_by_v", [1, 1, None, None])
+ assert_one(session, "SELECT * FROM t", [1, 1, None, None])
+
+ # sstable 4, shadow view row (id=1, v=1), insert (id=1, v=2, ts=4)
+ self.update_view(session, "UPDATE t USING TIMESTAMP 4 set v = 2 WHERE id = 1;", flush)
+ assert_one(session, "SELECT * FROM t_by_v", [2, 1, None, None])
+ assert_one(session, "SELECT * FROM t", [1, 2, None, None])
+
+ # sstable 5, shadow view row (id=1, v=2), insert (id=1, v=1 ts=5)
+ self.update_view(session, "UPDATE t USING TIMESTAMP 5 set v = 1 WHERE id = 1;", flush)
+ assert_one(session, "SELECT * FROM t_by_v", [1, 1, None, None])
+ assert_one(session, "SELECT * FROM t", [1, 1, None, None]) # data deleted by row-tombstone@2 should not resurrect
+
+ if flush:
+ for node in self.cluster.nodelist():
+ sstable_files = ' '.join(node.get_sstable_data_files('ks', 't_by_v'))
+ debug('Compacting {}'.format(sstable_files))
+ node.nodetool('compact --user-defined {}'.format(sstable_files))
+ assert_one(session, "SELECT * FROM t_by_v", [1, 1, None, None])
+ assert_one(session, "SELECT * FROM t", [1, 1, None, None]) # data deleted by row-tombstone@2 should not resurrect
+
+ # shadow view row (id=1, v=1)
+ self.update_view(session, "UPDATE t USING TIMESTAMP 5 set v = null WHERE id = 1;", flush)
+ assert_none(session, "SELECT * FROM t_by_v")
+ assert_one(session, "SELECT * FROM t", [1, None, None, None])
+
def view_tombstone_test(self):
"""
Test that a materialized views properly tombstone
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[42/50] cassandra git commit: Handle difference in sstablemetadata
output for pending repairs following CASSANDRA-11483
Posted by pa...@apache.org.
Handle difference in sstablemetadata output for pending repairs following CASSANDRA-11483
Patch by Joel Knighton; reviewed by Blake Eggleston for CASSANDRA-13755
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/013efa11
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/013efa11
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/013efa11
Branch: refs/heads/master
Commit: 013efa11f3d7bd2e3f64a4a5a865ff5dad565552
Parents: 61cbd5c
Author: Joel Knighton <jk...@apache.org>
Authored: Wed Aug 9 13:03:21 2017 -0500
Committer: Blake Eggleston <bd...@gmail.com>
Committed: Thu Aug 10 15:34:00 2017 -0700
----------------------------------------------------------------------
repair_tests/incremental_repair_test.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/013efa11/repair_tests/incremental_repair_test.py
----------------------------------------------------------------------
diff --git a/repair_tests/incremental_repair_test.py b/repair_tests/incremental_repair_test.py
index a447d56..b081d44 100644
--- a/repair_tests/incremental_repair_test.py
+++ b/repair_tests/incremental_repair_test.py
@@ -34,7 +34,7 @@ class TestIncRepair(Tester):
def _get_repaired_data(cls, node, keyspace):
_sstable_name = compile('SSTable: (.+)')
_repaired_at = compile('Repaired at: (\d+)')
- _pending_repair = compile('Pending repair: (null|[a-f0-9\-]+)')
+ _pending_repair = compile('Pending repair: (\-\-|null|[a-f0-9\-]+)')
_sstable_data = namedtuple('_sstabledata', ('name', 'repaired', 'pending_id'))
out = node.run_sstablemetadata(keyspace=keyspace).stdout
@@ -45,7 +45,7 @@ class TestIncRepair(Tester):
repaired_times = [int(m.group(1)) for m in matches(_repaired_at)]
def uuid_or_none(s):
- return None if s == 'null' else UUID(s)
+ return None if s == 'null' or s == '--' else UUID(s)
pending_repairs = [uuid_or_none(m.group(1)) for m in matches(_pending_repair)]
assert names
assert repaired_times
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[11/50] cassandra git commit: Add a sleep after compaction to give it
time before checking SSTable directory for files (CASSANDRA-13182)
Posted by pa...@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/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/538d658e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/538d658e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[33/50] cassandra git commit: Handle index order in describe output
on 2.1
Posted by pa...@apache.org.
Handle index order in describe output on 2.1
Patch by Joel Knighton; reviewed by Philip Thompson
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d040629b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d040629b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d040629b
Branch: refs/heads/master
Commit: d040629b2a71286105346c3cc637f8d1e16cf0a1
Parents: cc355ff
Author: Joel Knighton <jk...@apache.org>
Authored: Wed Jul 12 16:56:08 2017 -0500
Committer: Joel Knighton <jk...@apache.org>
Committed: Thu Jul 13 15:17:52 2017 -0500
----------------------------------------------------------------------
cqlsh_tests/cqlsh_tests.py | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d040629b/cqlsh_tests/cqlsh_tests.py
----------------------------------------------------------------------
diff --git a/cqlsh_tests/cqlsh_tests.py b/cqlsh_tests/cqlsh_tests.py
index e7bc11c..418b9f7 100644
--- a/cqlsh_tests/cqlsh_tests.py
+++ b/cqlsh_tests/cqlsh_tests.py
@@ -913,6 +913,9 @@ VALUES (4, blobAsInt(0x), '', blobAsBigint(0x), 0x, blobAsBoolean(0x), blobAsDec
return ret + "\n" + col_idx_def
def get_users_table_output(self):
+ quoted_index_output = self.get_index_output('"QuotedNameIndex"', 'test', 'users', 'firstname')
+ myindex_output = self.get_index_output('myindex', 'test', 'users', 'age')
+
if self.cluster.version() >= LooseVersion('3.9'):
return """
CREATE TABLE test.users (
@@ -934,8 +937,7 @@ 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('"QuotedNameIndex"', 'test', 'users', 'firstname') \
- + "\n" + self.get_index_output('myindex', 'test', 'users', 'age')
+ """ + quoted_index_output + "\n" + myindex_output
elif self.cluster.version() >= LooseVersion('3.0'):
return """
CREATE TABLE test.users (
@@ -957,8 +959,7 @@ 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('"QuotedNameIndex"', 'test', 'users', 'firstname') \
- + "\n" + self.get_index_output('myindex', 'test', 'users', 'age')
+ """ + quoted_index_output + "\n" + myindex_output
else:
return """
CREATE TABLE test.users (
@@ -979,8 +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('QuotedNameIndex', 'test', 'users', 'firstname') \
- + "\n" + self.get_index_output('myindex', 'test', 'users', 'age')
+ """ + (quoted_index_output + "\n" + myindex_output if self.cluster.version() >= LooseVersion('2.2') else
+ myindex_output + "\n" + quoted_index_output)
def get_index_output(self, index, ks, table, col):
# a quoted index name (e.g. "FooIndex") is only correctly echoed by DESCRIBE
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[14/50] cassandra git commit: Bump CCM version to 2.6.3
Posted by pa...@apache.org.
Bump CCM version to 2.6.3
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6f7caba9
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6f7caba9
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[25/50] cassandra git commit: CASSANDRA-10130 (#1486)
Posted by pa...@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/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/50e1e7b1
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/50e1e7b1
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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/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/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
[41/50] cassandra git commit: Restore <4.0 compatibility for digest
mismatch log message matching
Posted by pa...@apache.org.
Restore <4.0 compatibility for digest mismatch log message matching
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/61cbd5cd
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/61cbd5cd
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/61cbd5cd
Branch: refs/heads/master
Commit: 61cbd5cdcb435503bcb828249cce60ca779995e0
Parents: 459943a
Author: Stefan Podkowinski <st...@1und1.de>
Authored: Thu Aug 10 09:02:24 2017 +0200
Committer: Stefan Podkowinski <st...@1und1.de>
Committed: Thu Aug 10 09:02:24 2017 +0200
----------------------------------------------------------------------
materialized_views_test.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/61cbd5cd/materialized_views_test.py
----------------------------------------------------------------------
diff --git a/materialized_views_test.py b/materialized_views_test.py
index 79679ca..574d90f 100644
--- a/materialized_views_test.py
+++ b/materialized_views_test.py
@@ -1063,8 +1063,9 @@ class TestMaterializedViews(Tester):
# execution happening
# Look for messages like:
- # Digest mismatch: Mismatch for key DecoratedKey
- regex = r"Digest mismatch: Mismatch for key DecoratedKey"
+ # 4.0+ Digest mismatch: Mismatch for key DecoratedKey
+ # <4.0 Digest mismatch: org.apache.cassandra.service.DigestMismatchException: Mismatch for key DecoratedKey
+ regex = r"Digest mismatch: ([a-zA-Z.]+:\s)?Mismatch for key DecoratedKey"
for event in trace.events:
desc = event.description
match = re.match(regex, desc)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[08/50] cassandra git commit: Preserve DESCRIBE behaviour with quoted
index names for older versions
Posted by pa...@apache.org.
Preserve DESCRIBE behaviour with quoted index names for older versions
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/afda2d45
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/afda2d45
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[27/50] cassandra git commit: Fix do_upgrade in batch_test.py to
upgrade to the current version
Posted by pa...@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/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/557ab7b6
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/557ab7b6
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[26/50] cassandra git commit: Expand 9673 tests to also run on 3.x
Posted by pa...@apache.org.
Expand 9673 tests to also run on 3.x
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d2d9e6d4
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d2d9e6d4
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[39/50] cassandra git commit: Add test verifying that a schema
propagation adding a view over a non existing table doesn't prevent a node
from start
Posted by pa...@apache.org.
Add test verifying that a schema propagation adding a view over a non existing table doesn't prevent a node from start
patch by Andres de la Peña; reviewed by Jake Luciani for CASSANDRA-13737
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/95920874
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/95920874
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/95920874
Branch: refs/heads/master
Commit: 959208749d70e5808aec144e87b73e90d56a7f91
Parents: 7e3bcfd
Author: Andrés de la Peña <a....@gmail.com>
Authored: Tue Aug 8 10:01:15 2017 +0100
Committer: Andrés de la Peña <a....@gmail.com>
Committed: Tue Aug 8 10:01:15 2017 +0100
----------------------------------------------------------------------
materialized_views_test.py | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/95920874/materialized_views_test.py
----------------------------------------------------------------------
diff --git a/materialized_views_test.py b/materialized_views_test.py
index 306d719..77b20e6 100644
--- a/materialized_views_test.py
+++ b/materialized_views_test.py
@@ -1532,6 +1532,41 @@ class TestMaterializedViews(Tester):
session.execute("DROP MATERIALIZED VIEW mv")
session.execute("DROP TABLE test")
+ def propagate_view_creation_over_non_existing_table(self):
+ """
+ The internal addition of a view over a non existing table should be ignored
+ @jira_ticket CASSANDRA-13737
+ """
+
+ cluster = self.cluster
+ cluster.populate(3)
+ cluster.start()
+ node1, node2, node3 = self.cluster.nodelist()
+ session = self.patient_cql_connection(node1, consistency_level=ConsistencyLevel.QUORUM)
+ create_ks(session, 'ks', 3)
+
+ session.execute('CREATE TABLE users (username varchar PRIMARY KEY, state varchar)')
+
+ # create a materialized view only in nodes 1 and 2
+ node3.stop(wait_other_notice=True)
+ session.execute(('CREATE MATERIALIZED VIEW users_by_state AS '
+ 'SELECT * FROM users WHERE state IS NOT NULL AND username IS NOT NULL '
+ 'PRIMARY KEY (state, username)'))
+
+ # drop the base table only in node 3
+ node1.stop(wait_other_notice=True)
+ node2.stop(wait_other_notice=True)
+ node3.start(wait_for_binary_proto=True)
+ session = self.patient_cql_connection(node3, consistency_level=ConsistencyLevel.QUORUM)
+ session.execute('DROP TABLE ks.users')
+
+ # restart the cluster
+ cluster.stop()
+ cluster.start()
+
+ # node3 should have received and ignored the creation of the MV over the dropped table
+ self.assertTrue(node3.grep_log('Not adding view users_by_state because the base table'))
+
# For read verification
class MutationPresence(Enum):
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[40/50] cassandra git commit: Update regex for expected digest
mismatch log message
Posted by pa...@apache.org.
Update regex for expected digest mismatch log message
patch by Zhao Yang; reviewed by Stefan Podkowinski for CASSANDRA-13723
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/459943a3
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/459943a3
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/459943a3
Branch: refs/heads/master
Commit: 459943a35e7ea9ef49791b47bebaacc0b5af6e04
Parents: 9592087
Author: Zhao Yang <zh...@gmail.com>
Authored: Mon Aug 7 15:49:04 2017 +0800
Committer: Stefan Podkowinski <st...@1und1.de>
Committed: Thu Aug 10 08:30:39 2017 +0200
----------------------------------------------------------------------
materialized_views_test.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/459943a3/materialized_views_test.py
----------------------------------------------------------------------
diff --git a/materialized_views_test.py b/materialized_views_test.py
index 77b20e6..79679ca 100644
--- a/materialized_views_test.py
+++ b/materialized_views_test.py
@@ -228,7 +228,6 @@ class TestMaterializedViews(Tester):
debug("wait that all batchlogs are replayed")
self._replay_batchlogs()
-
for i in xrange(5):
for j in xrange(10000):
assert_one(session, "SELECT * FROM t_by_v WHERE id = {} AND v = {}".format(i, j), [j, i])
@@ -1064,8 +1063,8 @@ class TestMaterializedViews(Tester):
# execution happening
# Look for messages like:
- # Digest mismatch: org.apache.cassandra.service.DigestMismatchException: Mismatch for key DecoratedKey
- regex = r"Digest mismatch: org.apache.cassandra.service.DigestMismatchException: Mismatch for key DecoratedKey"
+ # Digest mismatch: Mismatch for key DecoratedKey
+ regex = r"Digest mismatch: Mismatch for key DecoratedKey"
for event in trace.events:
desc = event.description
match = re.match(regex, desc)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[13/50] cassandra git commit: Hinted handoff setmaxwindow test should
only run on versions >= 4.0
Posted by pa...@apache.org.
Hinted handoff setmaxwindow test should only run on versions >= 4.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/7f3566ad
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/7f3566ad
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[23/50] cassandra git commit: Force decommission on topology test
where required on 4.0+, run with vnodes
Posted by pa...@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/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c368a909
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c368a909
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[17/50] cassandra git commit: Reformated git install formatting from,
'git:cassandra-2.2', to, 'github:apache/cassandra-2.2'.
Posted by pa...@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/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c93bd487
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c93bd487
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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/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/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/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
[28/50] cassandra git commit: Add tests for 'nodetool
getbatchlogreplaythrottle' and 'nodetool setbatchlogreplaythrottle' (#1491)
Posted by pa...@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/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8cd52d67
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8cd52d67
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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/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
[15/50] cassandra git commit: Test for CASSANDRA-13559
Posted by pa...@apache.org.
Test for CASSANDRA-13559
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/bbe136cd
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/bbe136cd
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[20/50] cassandra git commit: Restrict size estimates multi-dc test
to run on 3.0.11+
Posted by pa...@apache.org.
Restrict size estimates multi-dc test to run on 3.0.11+
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/3cf276e9
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/3cf276e9
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[29/50] cassandra git commit: Adds the ability to use uncompressed
chunks in compressed files
Posted by pa...@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/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/058b9528
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/058b9528
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[34/50] cassandra git commit: Allow TRACE logging on upgrade tests
Posted by pa...@apache.org.
Allow TRACE logging on upgrade tests
patch by jasobrown, reviewed by mkjellman for CASSANDRA-13715
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/894bc92c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/894bc92c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/894bc92c
Branch: refs/heads/master
Commit: 894bc92c9608103b3c5656d6dd0233e514a57848
Parents: d040629
Author: Jason Brown <ja...@gmail.com>
Authored: Thu Jul 20 17:56:02 2017 -0700
Committer: Jason Brown <ja...@gmail.com>
Committed: Fri Jul 21 11:41:06 2017 -0700
----------------------------------------------------------------------
upgrade_tests/upgrade_base.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/894bc92c/upgrade_tests/upgrade_base.py
----------------------------------------------------------------------
diff --git a/upgrade_tests/upgrade_base.py b/upgrade_tests/upgrade_base.py
index 6d37468..65957bd 100644
--- a/upgrade_tests/upgrade_base.py
+++ b/upgrade_tests/upgrade_base.py
@@ -7,7 +7,7 @@ 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
+from dtest import CASSANDRA_VERSION_FROM_BUILD, TRACE, DEBUG, Tester, debug, create_ks
def switch_jdks(major_version_int):
@@ -161,7 +161,7 @@ class UpgradeTester(Tester):
if (new_version_from_build >= '3' and self.protocol_version is not None and self.protocol_version < 3):
self.skip('Protocol version {} incompatible '
'with Cassandra version {}'.format(self.protocol_version, new_version_from_build))
- node1.set_log_level("DEBUG" if DEBUG else "INFO")
+ node1.set_log_level("DEBUG" if DEBUG else "TRACE" if TRACE else "INFO")
node1.set_configuration_options(values={'internode_compression': 'none'})
if self.enable_for_jolokia:
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[31/50] cassandra git commit: Revert "Adds the ability to use
uncompressed chunks in compressed files"
Posted by pa...@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/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f1b0ba8a
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f1b0ba8a
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[24/50] cassandra git commit: Add dtests for compatibility flag
introduced in CASSANDRA-13004 (#1485)
Posted by pa...@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/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6847bc10
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6847bc10
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[38/50] cassandra git commit: Drop table should remove corresponding
entries in dropped_columns table
Posted by pa...@apache.org.
Drop table should remove corresponding entries in dropped_columns table
patch by Zhao Yang; reviewed by Aleksey Yeschenko for CASSANDRA-13730
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/7e3bcfd5
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/7e3bcfd5
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/7e3bcfd5
Branch: refs/heads/master
Commit: 7e3bcfd52fbc926b4c43e258a7e0efa19e1ca13d
Parents: 55c4ca8
Author: Zhao Yang <zh...@gmail.com>
Authored: Sun Jul 30 11:54:29 2017 +0800
Committer: Aleksey Yeschenko <al...@yeschenko.com>
Committed: Thu Aug 3 14:31:47 2017 +0100
----------------------------------------------------------------------
snapshot_test.py | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/7e3bcfd5/snapshot_test.py
----------------------------------------------------------------------
diff --git a/snapshot_test.py b/snapshot_test.py
index 563af81..1aa5a70 100644
--- a/snapshot_test.py
+++ b/snapshot_test.py
@@ -115,6 +115,40 @@ class TestSnapshot(SnapshotTester):
self.assertEqual(rows[0][0], 100)
+ @since('3.0')
+ def test_snapshot_and_restore_drop_table_remove_dropped_column(self):
+ """
+ @jira_ticket CASSANDRA-13730
+
+ Dropping table should clear entries in dropped_column table
+ """
+ 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"])
+
+ # Take a snapshot and drop the column and then drop table
+ snapshot_dir = self.make_snapshot(node1, 'ks', 'cf', 'basic')
+ session.execute("ALTER TABLE ks.cf DROP b")
+ assert_one(session, "SELECT * FROM ks.cf", [1, "a"])
+ session.execute("DROP TABLE ks.cf")
+
+ # Restore schema and data from snapshot, data should be the same as input
+ 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", "b"])
+
+ # Clean up
+ debug("removing snapshot_dir: " + snapshot_dir)
+ shutil.rmtree(snapshot_dir)
+
@since('3.11')
def test_snapshot_and_restore_dropping_a_column(self):
"""
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[36/50] cassandra git commit: Add tests for MVs when a column in the
base table is renamed with ALTER TABLE
Posted by pa...@apache.org.
Add tests for MVs when a column in the base table is renamed with ALTER TABLE
patch by Andres de la Peña; reviewed by Zhao Yang for CASSANDRA-12952
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d9c8cebc
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d9c8cebc
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d9c8cebc
Branch: refs/heads/master
Commit: d9c8cebc2d7907d04efb1ce81bda9e2fa2780530
Parents: b724df8
Author: Andrés de la Peña <a....@gmail.com>
Authored: Fri Jul 28 11:56:38 2017 +0100
Committer: Andrés de la Peña <a....@gmail.com>
Committed: Fri Jul 28 11:56:38 2017 +0100
----------------------------------------------------------------------
byteman/merge_schema_failure_3x.btm | 12 ++++++
byteman/merge_schema_failure_4x.btm | 12 ++++++
materialized_views_test.py | 73 +++++++++++++++++++++++++++++++-
3 files changed, 95 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d9c8cebc/byteman/merge_schema_failure_3x.btm
----------------------------------------------------------------------
diff --git a/byteman/merge_schema_failure_3x.btm b/byteman/merge_schema_failure_3x.btm
new file mode 100644
index 0000000..d4c9b36
--- /dev/null
+++ b/byteman/merge_schema_failure_3x.btm
@@ -0,0 +1,12 @@
+#
+# Inject node failure on merge schema exit.
+#
+RULE inject node failure on merge schema exit
+CLASS org.apache.cassandra.schema.SchemaKeyspace
+METHOD mergeSchema
+AT EXIT
+# set flag to only run this rule once.
+IF TRUE
+DO
+ System.exit(0)
+ENDRULE
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d9c8cebc/byteman/merge_schema_failure_4x.btm
----------------------------------------------------------------------
diff --git a/byteman/merge_schema_failure_4x.btm b/byteman/merge_schema_failure_4x.btm
new file mode 100644
index 0000000..bee5c3c
--- /dev/null
+++ b/byteman/merge_schema_failure_4x.btm
@@ -0,0 +1,12 @@
+#
+# Inject node failure on merge schema exit.
+#
+RULE inject node failure on merge schema exit
+CLASS org.apache.cassandra.schema.Schema
+METHOD merge
+AT EXIT
+# set flag to only run this rule once.
+IF TRUE
+DO
+ System.exit(0)
+ENDRULE
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d9c8cebc/materialized_views_test.py
----------------------------------------------------------------------
diff --git a/materialized_views_test.py b/materialized_views_test.py
index 0c9cdcb..306d719 100644
--- a/materialized_views_test.py
+++ b/materialized_views_test.py
@@ -8,6 +8,7 @@ from multiprocessing import Process, Queue
from unittest import skip, skipIf
from cassandra import ConsistencyLevel
+from cassandra.cluster import NoHostAvailable
from cassandra.concurrent import execute_concurrent_with_args
from cassandra.cluster import Cluster
from cassandra.query import SimpleStatement
@@ -40,9 +41,9 @@ class TestMaterializedViews(Tester):
@since 3.0
"""
- def prepare(self, user_table=False, rf=1, options=None, nodes=3, **kwargs):
+ def prepare(self, user_table=False, rf=1, options=None, nodes=3, install_byteman=False, **kwargs):
cluster = self.cluster
- cluster.populate([nodes, 0])
+ cluster.populate([nodes, 0], install_byteman=install_byteman)
if options:
cluster.set_configuration_options(values=options)
cluster.start()
@@ -773,6 +774,74 @@ class TestMaterializedViews(Tester):
['TX', 'user1']
)
+ def rename_column_test(self):
+ """
+ Test that a materialized view created with a 'SELECT *' works as expected when renaming a column
+ @expected_result The column is also renamed in the view.
+ """
+
+ session = self.prepare(user_table=True)
+
+ self._insert_data(session)
+
+ assert_one(
+ session,
+ "SELECT * FROM users_by_state WHERE state = 'TX' AND username = 'user1'",
+ ['TX', 'user1', 1968, 'f', 'ch@ngem3a', None]
+ )
+
+ session.execute("ALTER TABLE users RENAME username TO user")
+
+ results = list(session.execute("SELECT * FROM users_by_state WHERE state = 'TX' AND user = 'user1'"))
+ self.assertEqual(len(results), 1)
+ self.assertTrue(hasattr(results[0], 'user'), 'Column "user" not found')
+ assert_one(
+ session,
+ "SELECT state, user, birth_year, gender FROM users_by_state WHERE state = 'TX' AND user = 'user1'",
+ ['TX', 'user1', 1968, 'f']
+ )
+
+ def rename_column_atomicity_test(self):
+ """
+ Test that column renaming is atomically done between a table and its materialized views
+ @jira_ticket CASSANDRA-12952
+ """
+
+ session = self.prepare(nodes=1, user_table=True, install_byteman=True)
+ node = self.cluster.nodelist()[0]
+
+ self._insert_data(session)
+
+ assert_one(
+ session,
+ "SELECT * FROM users_by_state WHERE state = 'TX' AND username = 'user1'",
+ ['TX', 'user1', 1968, 'f', 'ch@ngem3a', None]
+ )
+
+ # Rename a column with an injected byteman rule to kill the node after the first schema update
+ self.allow_log_errors = True
+ script_version = '4x' if self.cluster.version() >= '4' else '3x'
+ node.byteman_submit(['./byteman/merge_schema_failure_{}.btm'.format(script_version)])
+ with self.assertRaises(NoHostAvailable):
+ session.execute("ALTER TABLE users RENAME username TO user")
+
+ debug('Restarting node')
+ node.stop()
+ node.start(wait_for_binary_proto=True)
+ session = self.patient_cql_connection(node, consistency_level=ConsistencyLevel.ONE)
+
+ # Both the table and its view should have the new schema after restart
+ assert_one(
+ session,
+ "SELECT * FROM ks.users WHERE state = 'TX' AND user = 'user1' ALLOW FILTERING",
+ ['user1', 1968, 'f', 'ch@ngem3a', None, 'TX']
+ )
+ assert_one(
+ session,
+ "SELECT * FROM ks.users_by_state WHERE state = 'TX' AND user = 'user1'",
+ ['TX', 'user1', 1968, 'f', 'ch@ngem3a', None]
+ )
+
def lwt_test(self):
"""Test that lightweight transaction behave properly with a materialized view"""
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[46/50] cassandra git commit: Bump CCM version to 2.8.1
Posted by pa...@apache.org.
Bump CCM version to 2.8.1
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6d5ee379
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6d5ee379
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6d5ee379
Branch: refs/heads/master
Commit: 6d5ee3792dd226b0eea5afaadf8489b150ea4b18
Parents: da6ad83
Author: Michael Shuler <mi...@pbandjelly.org>
Authored: Fri Aug 25 07:56:20 2017 -0500
Committer: Michael Shuler <mi...@pbandjelly.org>
Committed: Fri Aug 25 07:56:20 2017 -0500
----------------------------------------------------------------------
requirements.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6d5ee379/requirements.txt
----------------------------------------------------------------------
diff --git a/requirements.txt b/requirements.txt
index 9be7094..058ea38 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.3
+ccm==2.8.1
cql
decorator
docopt
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[47/50] cassandra git commit: Add tests for mixed version batchlog
replay
Posted by pa...@apache.org.
Add tests for mixed version batchlog replay
Patch by Jeff Jirsa; reviewed by Aleksey Yeschenko
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ac9c9560
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ac9c9560
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ac9c9560
Branch: refs/heads/master
Commit: ac9c95607ce439de596da41c368d79c67d6dcdda
Parents: 6d5ee37
Author: Jeff Jirsa <jj...@apple.com>
Authored: Mon Aug 14 12:55:17 2017 -0700
Committer: Aleksey Yeschenko <al...@yeschenko.com>
Committed: Sat Aug 26 01:21:00 2017 +0100
----------------------------------------------------------------------
batch_test.py | 96 +++++++++++++++++++++++-------
byteman/fail_after_batchlog_write.btm | 19 ++++++
2 files changed, 94 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ac9c9560/batch_test.py
----------------------------------------------------------------------
diff --git a/batch_test.py b/batch_test.py
index 4194f10..5c25c46 100644
--- a/batch_test.py
+++ b/batch_test.py
@@ -1,6 +1,7 @@
import sys
import time
from unittest import skipIf
+from nose.tools import assert_greater_equal
from cassandra import ConsistencyLevel, Timeout, Unavailable
from cassandra.query import SimpleStatement
@@ -9,6 +10,8 @@ from dtest import Tester, create_ks, debug
from tools.assertions import (assert_all, assert_invalid, assert_one,
assert_unavailable)
from tools.decorators import since
+from tools.jmxutils import (JolokiaAgent, make_mbean,
+ remove_perf_disable_shared_mem)
class TestBatch(Tester):
@@ -295,6 +298,15 @@ class TestBatch(Tester):
self._logged_batch_compatibility_test(0, 1, 'github:apache/cassandra-2.2', 2, 4)
@since('3.0', max_version='3.x')
+ def batchlog_replay_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/3.x node and two 2.2 nodes and we send the batch request to the 3.0 node.
+ """
+ self._batchlog_replay_compatibility_test(0, 1, 'github:apache/cassandra-2.2', 2, 4)
+
+ @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):
"""
@@ -324,6 +336,15 @@ class TestBatch(Tester):
self._logged_batch_compatibility_test(2, 2, 'github:apache/cassandra-2.2', 1, 4)
@since('3.0', max_version='3.x')
+ def batchlog_replay_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/3.x nodes and one 2.2 node and we send the batch request to the 2.2 node.
+ """
+ self._batchlog_replay_compatibility_test(2, 2, 'github:apache/cassandra-2.2', 1, 4)
+
+ @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):
"""
@@ -346,6 +367,43 @@ class TestBatch(Tester):
res = sorted(rows)
self.assertEquals([[0, 'Jack', 'Sparrow'], [1, 'Will', 'Turner']], [list(res[0]), list(res[1])])
+ def _batchlog_replay_compatibility_test(self, coordinator_idx, current_nodes, previous_version, previous_nodes, protocol_version):
+ session = self.prepare_mixed(coordinator_idx, current_nodes, previous_version, previous_nodes,
+ protocol_version=protocol_version, install_byteman=True)
+
+ coordinator = self.cluster.nodelist()[coordinator_idx]
+ coordinator.byteman_submit(['./byteman/fail_after_batchlog_write.btm'])
+ debug("Injected byteman scripts to enable batchlog replay {}".format(coordinator.name))
+
+ query = """
+ BEGIN BATCH
+ INSERT INTO users (id, firstname, lastname) VALUES (0, 'Jack', 'Sparrow')
+ INSERT INTO users (id, firstname, lastname) VALUES (1, 'Will', 'Turner')
+ APPLY BATCH
+ """
+ session.execute(query)
+
+ total_batches_replayed = 0
+ blm = make_mbean('db', type='BatchlogManager')
+
+ for n in self.cluster.nodelist():
+ if n == coordinator:
+ continue
+
+ with JolokiaAgent(n) as jmx:
+ debug('Forcing batchlog replay for {}'.format(n.name))
+ jmx.execute_method(blm, 'forceBatchlogReplay')
+ batches_replayed = jmx.read_attribute(blm, 'TotalBatchesReplayed')
+ debug('{} batches replayed on node {}'.format(batches_replayed, n.name))
+ total_batches_replayed += batches_replayed
+
+ assert_greater_equal(total_batches_replayed, 2)
+
+ for node in self.cluster.nodelist():
+ session = self.patient_exclusive_cql_connection(node, protocol_version=protocol_version)
+ rows = sorted(session.execute('SELECT id, firstname, lastname FROM ks.users'))
+ self.assertEqual([[0, 'Jack', 'Sparrow'], [1, 'Will', 'Turner']], [list(rows[0]), list(rows[1])])
+
def assert_timedout(self, session, query, cl, acknowledged_by=None,
received_responses=None):
try:
@@ -366,15 +424,17 @@ class TestBatch(Tester):
else:
assert False, "Expecting TimedOutException but no exception was raised"
- def prepare(self, nodes=1, compression=True, version=None, protocol_version=None):
- if not self.cluster.nodelist():
- self.cluster.populate(nodes)
- if version:
- for node in self.cluster.nodelist():
- node.set_install_dir(version=version)
- debug("Set cassandra dir for {} to {}".format(node.name, node.get_install_dir()))
+ def prepare(self, nodes=1, compression=True, version=None, protocol_version=None, install_byteman=False):
+ if version:
+ self.cluster.set_install_dir(version=version)
+ debug("Set cassandra dir to {}".format(self.cluster.get_install_dir()))
+
+ self.cluster.populate(nodes, install_byteman=install_byteman)
+
+ for n in self.cluster.nodelist():
+ remove_perf_disable_shared_mem(n)
- self.cluster.start(wait_other_notice=True)
+ self.cluster.start(wait_other_notice=True)
node1 = self.cluster.nodelist()[0]
session = self.patient_cql_connection(node1, protocol_version=protocol_version)
@@ -405,13 +465,12 @@ class TestBatch(Tester):
time.sleep(.5)
- def prepare_mixed(self, coordinator_idx, current_nodes, previous_version, previous_nodes, compression=True, protocol_version=None):
-
+ def prepare_mixed(self, coordinator_idx, current_nodes, previous_version, previous_nodes, compression=True, protocol_version=None, install_byteman=False):
debug("Testing with {} node(s) at version '{}', {} node(s) at current version"
.format(previous_nodes, previous_version, current_nodes))
# start a cluster using the previous version
- self.prepare(previous_nodes + current_nodes, compression, previous_version, protocol_version=protocol_version)
+ self.prepare(previous_nodes + current_nodes, compression, previous_version, protocol_version=protocol_version, install_byteman=install_byteman)
# then upgrade the current nodes to the current version but not the previous nodes
for i in xrange(current_nodes):
@@ -426,18 +485,13 @@ class TestBatch(Tester):
"""
Upgrade a node to the current version
"""
- debug('Upgrading {}'.format(node.name))
-
- debug('Shutting down node: ' + node.name)
- node.drain()
- node.watch_log_for("DRAINED")
+ debug('Upgrading {} to the current version'.format(node.name))
+ debug('Shutting down {}'.format(node.name))
node.stop(wait_other_notice=False)
-
self.set_node_to_current_version(node)
- debug("Set new cassandra dir for {}: {}".format(node.name, node.get_install_dir()))
-
+ debug("Set cassandra dir for {} to {}".format(node.name, node.get_install_dir()))
+ # needed for jmx
+ remove_perf_disable_shared_mem(node)
# Restart nodes on new version
debug('Starting {} on new version ({})'.format(node.name, node.get_cassandra_version()))
node.start(wait_other_notice=True, wait_for_binary_proto=True)
- debug('Upgrading sstables')
- node.nodetool('upgradesstables -a')
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ac9c9560/byteman/fail_after_batchlog_write.btm
----------------------------------------------------------------------
diff --git a/byteman/fail_after_batchlog_write.btm b/byteman/fail_after_batchlog_write.btm
new file mode 100644
index 0000000..8574b00
--- /dev/null
+++ b/byteman/fail_after_batchlog_write.btm
@@ -0,0 +1,19 @@
+#
+# Inject node failure immediately after batchlog write.
+# Method signature required in 3.x to avoid pausing before legacy mutations sent
+#
+RULE skip writing batched mutations
+CLASS org.apache.cassandra.service.StorageProxy
+METHOD syncWriteBatchedMutations
+AT ENTRY
+IF TRUE
+DO return
+ENDRULE
+
+RULE skip removing from batchlog
+CLASS org.apache.cassandra.service.StorageProxy
+METHOD asyncRemoveFromBatchlog
+AT ENTRY
+IF TRUE
+DO return
+ENDRULE
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[02/50] cassandra git commit: Create test for restoring a snapshot
with dropped columns (CASSANDRA-13276)
Posted by pa...@apache.org.
Create test for restoring a snapshot with dropped columns (CASSANDRA-13276)
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e6b47064
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e6b47064
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[07/50] cassandra git commit: Fix version check after C* ticket was
committed
Posted by pa...@apache.org.
Fix version check after C* ticket was committed
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/5c99d202
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5c99d202
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[09/50] cassandra git commit: Include quoted index names in describe
test
Posted by pa...@apache.org.
Include quoted index names in describe test
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f2925484
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f2925484
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[10/50] cassandra git commit: Add upgrade test for old format indexed
sstables (CASSANDRA-13236)
Posted by pa...@apache.org.
Add upgrade test for old format indexed sstables (CASSANDRA-13236)
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f1489423
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f1489423
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[03/50] cassandra git commit: CASSANDRA-13483: fixed test failure in
snapshot_test.TestSnapshot.test_snapshot_and_restore_dropping_a_column
Posted by pa...@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/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0667de02
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0667de02
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[19/50] cassandra git commit: CASSANDRA-9143 change needs dtest change
Posted by pa...@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/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f69ced02
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f69ced02
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[04/50] cassandra git commit: adding test for repair preview
introduced in CASSANDRA-13257 (#1465)
Posted by pa...@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/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d5c413c4
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d5c413c4
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[43/50] cassandra git commit: Fix jolokia for mixed version clusters
Posted by pa...@apache.org.
Fix jolokia for mixed version clusters
Patch by Jeff Jirsa; Reviewed by Aleksey Yeshchenko
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b8842b97
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b8842b97
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b8842b97
Branch: refs/heads/master
Commit: b8842b979244547dd43d48bbaeadf1cea34a9fef
Parents: 013efa1
Author: Jeff Jirsa <jj...@apple.com>
Authored: Mon Aug 14 12:55:17 2017 -0700
Committer: Jeff Jirsa <jj...@apple.com>
Committed: Mon Aug 14 12:57:47 2017 -0700
----------------------------------------------------------------------
tools/jmxutils.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b8842b97/tools/jmxutils.py
----------------------------------------------------------------------
diff --git a/tools/jmxutils.py b/tools/jmxutils.py
index 1f41626..8c20eb8 100644
--- a/tools/jmxutils.py
+++ b/tools/jmxutils.py
@@ -158,7 +158,7 @@ def remove_perf_disable_shared_mem(node):
option (see https://github.com/rhuss/jolokia/issues/198 for details). This
edits cassandra-env.sh (or the Windows equivalent), or jvm.options file on 3.2+ to remove that option.
"""
- if node.cluster.version() >= LooseVersion('3.2'):
+ if node.get_cassandra_version() >= LooseVersion('3.2'):
conf_file = os.path.join(node.get_conf_dir(), JVM_OPTIONS)
pattern = '\-XX:\+PerfDisableSharedMem'
replacement = '#-XX:+PerfDisableSharedMem'
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[32/50] cassandra git commit: dtest failure in
offline_tools_test.TestOfflineTools.sstableofflinerelevel_test
Posted by pa...@apache.org.
dtest failure in offline_tools_test.TestOfflineTools.sstableofflinerelevel_test
Patch by Ariel Weisberg; Reviewed by Philip Thompson for CASSANDRA-12617
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/cc355ff2
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/cc355ff2
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/cc355ff2
Branch: refs/heads/master
Commit: cc355ff255f6b44f6b9b77dfd18a586885e2200a
Parents: f1b0ba8
Author: Ariel Weisberg <ar...@datastax.com>
Authored: Wed Jul 12 18:38:05 2017 -0400
Committer: Ariel Weisberg <ar...@datastax.com>
Committed: Wed Jul 12 18:38:05 2017 -0400
----------------------------------------------------------------------
offline_tools_test.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/cc355ff2/offline_tools_test.py
----------------------------------------------------------------------
diff --git a/offline_tools_test.py b/offline_tools_test.py
index c0a0010..028027d 100644
--- a/offline_tools_test.py
+++ b/offline_tools_test.py
@@ -158,7 +158,7 @@ class TestOfflineTools(Tester):
keys = 8 * cluster.data_dir_count
node1.stress(['write', 'n={0}K'.format(keys), 'no-warmup',
'-schema', 'replication(factor=1)',
- '-col', 'n=FIXED(10)', 'SIZE=FIXED(1024)',
+ '-col', 'n=FIXED(10)', 'SIZE=FIXED(1200)',
'-rate', 'threads=8'])
node1.flush()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[21/50] cassandra git commit: Merge pull request #1484 from
jkni/since-size-estimates
Posted by pa...@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/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/93aa3147
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/93aa3147
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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
[12/50] cassandra git commit: add test to confirm that hostname
validation is working
Posted by pa...@apache.org.
add test to confirm that hostname validation is working
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/bea71d8f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/bea71d8f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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
[05/50] cassandra git commit: adding cluster reconfiguration tests
for 9143 (#1468)
Posted by pa...@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/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/dc8cb3fb
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/dc8cb3fb
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/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/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