Repository: cassandra-dtest Updated Branches: refs/heads/master 7fd89e146 -> 2e0344c03
Make replica selection deterministic in read_repair_test Patch by Sam Tunnicliffe; reviewed by Marcus Eriksson for CASSANDRA-14244 Closes #20 Project: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/commit/2e0344c0 Tree: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/tree/2e0344c0 Diff: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/diff/2e0344c0 Branch: refs/heads/master Commit: 2e0344c0387310db7ed086743c3932c4a193d4bb Parents: 7fd89e1 Author: Sam Tunnicliffe <s...@beobal.com> Authored: Tue Feb 20 16:20:23 2018 -0800 Committer: Sam Tunnicliffe <s...@beobal.com> Committed: Tue Mar 6 13:47:54 2018 +0000 ---------------------------------------------------------------------- read_repair_test.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/2e0344c0/read_repair_test.py ---------------------------------------------------------------------- diff --git a/read_repair_test.py b/read_repair_test.py index 7e8d405..5fbe1ba 100644 --- a/read_repair_test.py +++ b/read_repair_test.py @@ -1,3 +1,4 @@ +import os import time import pytest import logging @@ -18,8 +19,20 @@ class TestReadRepair(Tester): @pytest.fixture(scope='function', autouse=True) def fixture_set_cluster_settings(self, fixture_dtest_setup): - fixture_dtest_setup.cluster.set_configuration_options(values={'hinted_handoff_enabled': False}) - fixture_dtest_setup.cluster.populate(3).start(wait_for_binary_proto=True) + cluster = fixture_dtest_setup.cluster + cluster.populate(3) + # disable dynamic snitch to make replica selection deterministic + # when we use patient_exclusive_cql_connection, CL=1 and RF=n + cluster.set_configuration_options(values={'hinted_handoff_enabled': False, + 'endpoint_snitch': 'GossipingPropertyFileSnitch', + 'dynamic_snitch': False}) + for node in cluster.nodelist(): + with open(os.path.join(node.get_conf_dir(), 'cassandra-rackdc.properties'), 'w') as snitch_file: + snitch_file.write("dc=datacenter1" + os.linesep) + snitch_file.write("rack=rack1" + os.linesep) + snitch_file.write("prefer_local=true" + os.linesep) + + cluster.start(wait_for_binary_proto=True) @since('3.0') def test_alter_rf_and_run_read_repair(self): @@ -118,10 +131,13 @@ class TestReadRepair(Tester): :param session: Used to perform the schema setup & insert the data :return: a tuple containing the node which initially acts as the replica, and a list of the other two nodes """ - # Disable speculative retry to make it clear that we only query additional nodes because of read_repair_chance + # Disable speculative retry and [dclocal]read_repair in initial setup. session.execute("""CREATE KEYSPACE alter_rf_test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};""") - session.execute("CREATE TABLE alter_rf_test.t1 (k int PRIMARY KEY, a int, b int) WITH speculative_retry='NONE';") + session.execute("""CREATE TABLE alter_rf_test.t1 (k int PRIMARY KEY, a int, b int) + WITH speculative_retry='NONE' + AND read_repair_chance=0 + AND dclocal_read_repair_chance=0;""") session.execute("INSERT INTO alter_rf_test.t1 (k, a, b) VALUES (1, 1, 1);") # identify the initial replica and trigger a flush to ensure reads come from sstables @@ -184,7 +200,6 @@ class TestReadRepair(Tester): if res != expected: raise NotRepairedException() - @since('2.0') def test_range_slice_query_with_tombstones(self): """ --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org