You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by aw...@apache.org on 2017/11/15 21:47:00 UTC
[32/50] cassandra git commit: Fix counter application order in short
read protection
Fix counter application order in short read protection
patch by Aleksey Yeschenko; reviewed by Benedict Elliott Smith for
CASSANDRA-12872
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/9119cdfe
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/9119cdfe
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/9119cdfe
Branch: refs/heads/master
Commit: 9119cdfe921a2f39a315badd58900a12409d506e
Parents: 3435b0f
Author: Aleksey Yeschenko <al...@yeschenko.com>
Authored: Wed Sep 13 20:48:01 2017 +0100
Committer: Aleksey Yeschenko <al...@yeschenko.com>
Committed: Fri Sep 15 17:40:48 2017 +0100
----------------------------------------------------------------------
consistency_test.py | 70 +++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 69 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/9119cdfe/consistency_test.py
----------------------------------------------------------------------
diff --git a/consistency_test.py b/consistency_test.py
index b50d81b..27e5d01 100644
--- a/consistency_test.py
+++ b/consistency_test.py
@@ -10,7 +10,8 @@ from cassandra.query import SimpleStatement
from nose.plugins.attrib import attr
from nose.tools import assert_greater_equal
-from tools.assertions import assert_length_equal, assert_none, assert_unavailable
+from tools.assertions import (assert_all, assert_length_equal, assert_none,
+ assert_unavailable)
from dtest import DISABLE_VNODES, MultiError, Tester, debug, create_ks, create_cf
from tools.data import (create_c1c2_table, insert_c1c2, insert_columns,
query_c1c2, rows_to_list)
@@ -825,6 +826,73 @@ class TestConsistency(Tester):
result = list(session.execute(stmt))
assert_length_equal(result, 5)
+ @since('3.0')
+ def test_12872(self):
+ """
+ @jira_ticket CASSANDRA-12872
+ """
+ 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 test.test (pk int, ck int, PRIMARY KEY (pk, ck));"
+ session.execute(query)
+
+ stmt = session.prepare("INSERT INTO test.test (pk, ck) VALUES (0, ?);")
+ for ck in range(0, 4):
+ session.execute(stmt, [ck], ConsistencyLevel.ALL)
+
+ # node1 | up | 0 1 2 3
+ # node2 | up | 0 1 2 3
+
+ node2.stop(wait_other_notice=True)
+
+ # node1 | up | 0 1 2 3
+ # node2 | down | 0 1 2 3
+
+ session.execute('DELETE FROM test.test WHERE pk = 0 AND ck IN (1, 2, 3);')
+
+ # node1 | up | 0 x x x
+ # node2 | down | 0 1 2 3
+
+ session.execute('INSERT INTO test.test (pk, ck) VALUES (0, 5);')
+
+ # node1 | up | 0 x x x 5
+ # node2 | down | 0 1 2 3
+
+ node2.start(wait_other_notice=True)
+ node1.stop(wait_other_notice=True)
+
+ # node1 | down | 0 x x x 5
+ # node2 | up | 0 1 2 3
+
+ session = self.patient_cql_connection(node2)
+
+ session.execute('INSERT INTO test.test (pk, ck) VALUES (0, 4);')
+
+ # node1 | down | 0 x x x 5
+ # node2 | up | 0 1 2 3 4
+
+ node1.start(wait_other_notice=True)
+
+ # node1 | up | 0 x x x 5
+ # node2 | up | 0 1 2 3 4
+
+ assert_all(session,
+ 'SELECT ck FROM test.test WHERE pk = 0 LIMIT 2;',
+ [[0], [4]],
+ cl = ConsistencyLevel.ALL)
+
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