Skip to content

Commit c32760d

Browse files
jtgrabowskijacek-lewandowski
authored andcommitted
STAR-452: add EverywhereStrategy smoke test (#10)
(cherry picked from commit eb3049c) (cherry picked from commit fe23e0b) (cherry picked from commit af5e094) (cherry picked from commit caaa548) (cherry picked from commit 31b6a86)
1 parent 5600c72 commit c32760d

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

bootstrap_test.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,57 @@ def test_bootstrap_binary_disabled(self):
10201020
assert_bootstrap_state(self, node3, 'COMPLETED', user='cassandra', password='cassandra')
10211021
node3.wait_for_binary_interface()
10221022

1023+
@since('4.0')
1024+
@pytest.mark.no_vnodes
1025+
def test_simple_bootstrap_with_everywhere_strategy(self):
1026+
cluster = self.cluster
1027+
tokens = cluster.balanced_tokens(2)
1028+
cluster.set_configuration_options(values={'num_tokens': 1})
1029+
1030+
logger.debug("[node1, node2] tokens: %r" % (tokens,))
1031+
1032+
keys = 10000
1033+
1034+
# Create a single node cluster
1035+
cluster.populate(1)
1036+
node1 = cluster.nodelist()[0]
1037+
node1.set_configuration_options(values={'initial_token': tokens[0]})
1038+
cluster.start()
1039+
1040+
session = self.patient_cql_connection(node1)
1041+
create_ks(session, 'ks', 'EverywhereStrategy')
1042+
create_cf(session, 'cf', columns={'c1': 'text', 'c2': 'text'})
1043+
1044+
insert_statement = session.prepare("INSERT INTO ks.cf (key, c1, c2) VALUES (?, 'value1', 'value2')")
1045+
execute_concurrent_with_args(session, insert_statement, [['k%d' % k] for k in range(keys)])
1046+
1047+
node1.flush()
1048+
node1.compact()
1049+
1050+
# Reads inserted data all during the bootstrap process. We shouldn't
1051+
# get any error
1052+
query_c1c2(session, random.randint(0, keys - 1), ConsistencyLevel.ONE)
1053+
session.shutdown()
1054+
1055+
# Bootstrapping a new node in the current version
1056+
node2 = new_node(cluster)
1057+
node2.set_configuration_options(values={'initial_token': tokens[1]})
1058+
node2.start(wait_for_binary_proto=True)
1059+
node2.compact()
1060+
1061+
node1.cleanup()
1062+
logger.debug("node1 size for ks.cf after cleanup: %s" % float(data_size(node1,'ks','cf')))
1063+
node1.compact()
1064+
logger.debug("node1 size for ks.cf after compacting: %s" % float(data_size(node1,'ks','cf')))
1065+
1066+
logger.debug("node2 size for ks.cf after compacting: %s" % float(data_size(node2,'ks','cf')))
1067+
1068+
size1 = float(data_size(node1,'ks','cf'))
1069+
size2 = float(data_size(node2,'ks','cf'))
1070+
assert_almost_equal(size1, size2, error=0.3)
1071+
1072+
assert_bootstrap_state(self, node2, 'COMPLETED')
1073+
10231074
@since('4.1')
10241075
def test_invalid_host_id(self):
10251076
"""

dtest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,8 @@ def create_ks(session, name, rf):
364364
if isinstance(rf, int):
365365
# we assume simpleStrategy
366366
query = query % (name, "'class':'SimpleStrategy', 'replication_factor':%d" % rf)
367+
elif 'EverywhereStrategy' in rf:
368+
query = query % (name, "'class':'org.apache.cassandra.locator.EverywhereStrategy'")
367369
else:
368370
assert len(rf) >= 0, "At least one datacenter/rf pair is needed"
369371
# we assume networkTopologyStrategy

0 commit comments

Comments
 (0)