This is an automated email from the ASF dual-hosted git repository.

jlewandowski pushed a commit to branch ds-trunk-5.0--2024-07-24
in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git

commit aa0ec1ad16c70e331cf551aaf8b6bdfcc9bb30b9
Author: Jaroslaw Grabowski <[email protected]>
AuthorDate: Wed Apr 21 14:50:11 2021 +0200

    STAR-452: add EverywhereStrategy smoke test (#10)
    
    (cherry picked from commit eb3049c6e2e79dd13da68187cf3d67a2577228cf)
    (cherry picked from commit fe23e0b086ef342de3003ff27c163217dd8fd207)
    (cherry picked from commit af5e094eb6ad961c9aee0ab465f128908ca1bcfa)
    (cherry picked from commit caaa548d0ad3f9bb224048d8f070fea45340974a)
    (cherry picked from commit 31b6a863c0ebb0603ef532a342ccecdf35721dd9)
    (cherry picked from commit c32760d592334be9e7ddf06c9d36647b7904f969)
    (cherry picked from commit abc36a89f8dbde26a97a3332e4260d9734e5c6d7)
    (cherry picked from commit 510ee55b6746c8e1a7dca35ef19e1bddfb499564)
    (cherry picked from commit c7d5965e3c66bd87dc52ead26014e610b435d00b)
---
 bootstrap_test.py                                  | 50 ++++++++++++++++++++++
 dtest.py                                           |  2 +
 ...AR-452: add EverywhereStrategy smoke test (#10) | 41 ++++++++++++++++++
 3 files changed, 93 insertions(+)

diff --git a/bootstrap_test.py b/bootstrap_test.py
index ec01b892..043a734a 100644
--- a/bootstrap_test.py
+++ b/bootstrap_test.py
@@ -1075,6 +1075,56 @@ class BootstrapTester(Tester):
             nt_resume_cmd += ' -f'
         return nt_resume_cmd
 
+    @since('4.0')
+    @pytest.mark.no_vnodes
+    def test_simple_bootstrap_with_everywhere_strategy(self):
+        cluster = self.cluster
+        tokens = cluster.balanced_tokens(2)
+        cluster.set_configuration_options(values={'num_tokens': 1})
+
+        logger.debug("[node1, node2] tokens: %r" % (tokens,))
+
+        keys = 10000
+
+        # Create a single node cluster
+        cluster.populate(1)
+        node1 = cluster.nodelist()[0]
+        node1.set_configuration_options(values={'initial_token': tokens[0]})
+        cluster.start()
+
+        session = self.patient_cql_connection(node1)
+        create_ks(session, 'ks', 'EverywhereStrategy')
+        create_cf(session, 'cf', columns={'c1': 'text', 'c2': 'text'})
+
+        insert_statement = session.prepare("INSERT INTO ks.cf (key, c1, c2) 
VALUES (?, 'value1', 'value2')")
+        execute_concurrent_with_args(session, insert_statement, [['k%d' % k] 
for k in range(keys)])
+
+        node1.flush()
+        node1.compact()
+
+        # Reads inserted data all during the bootstrap process. We shouldn't
+        # get any error
+        query_c1c2(session, random.randint(0, keys - 1), ConsistencyLevel.ONE)
+        session.shutdown()
+
+        # Bootstrapping a new node in the current version
+        node2 = new_node(cluster)
+        node2.set_configuration_options(values={'initial_token': tokens[1]})
+        node2.start(wait_for_binary_proto=True)
+        node2.compact()
+
+        node1.cleanup()
+        logger.debug("node1 size for ks.cf after cleanup: %s" % 
float(data_size(node1,'ks','cf')))
+        node1.compact()
+        logger.debug("node1 size for ks.cf after compacting: %s" % 
float(data_size(node1,'ks','cf')))
+
+        logger.debug("node2 size for ks.cf after compacting: %s" % 
float(data_size(node2,'ks','cf')))
+
+        size1 = float(data_size(node1,'ks','cf'))
+        size2 = float(data_size(node2,'ks','cf'))
+        assert_almost_equal(size1, size2, error=0.3)
+
+        assert_bootstrap_state(self, node2, 'COMPLETED')
 
 class TestBootstrap(BootstrapTester):
     """
diff --git a/dtest.py b/dtest.py
index da7b31a7..fbbf4e30 100644
--- a/dtest.py
+++ b/dtest.py
@@ -383,6 +383,8 @@ def create_ks(session, name, rf):
     if isinstance(rf, int):
         # we assume simpleStrategy
         query = query % (name, "'class':'SimpleStrategy', 
'replication_factor':%d" % rf)
+    elif 'EverywhereStrategy' in rf:
+        query = query % (name, 
"'class':'org.apache.cassandra.locator.EverywhereStrategy'")
     else:
         assert len(rf) >= 0, "At least one datacenter/rf pair is needed"
         # we assume networkTopologyStrategy
diff --git a/update-history/oss-4.0.11/23-510ee55b STAR-452: add 
EverywhereStrategy smoke test (#10) b/update-history/oss-4.0.11/23-510ee55b 
STAR-452: add EverywhereStrategy smoke test (#10)
new file mode 100644
index 00000000..2d3121de
--- /dev/null
+++ b/update-history/oss-4.0.11/23-510ee55b STAR-452: add EverywhereStrategy 
smoke test (#10)   
@@ -0,0 +1,41 @@
+--- a/bootstrap_test.py
++++ b/bootstrap_test.py
+@@ -1017,7 +1017,17 @@
+         assert_bootstrap_state(self, node3, 'COMPLETED', user='cassandra', 
password='cassandra')
+         node3.wait_for_binary_interface()
+ 
+-<<<<<<<
++    @staticmethod
++    def nodetool_resume_command(cluster):
++        """
++        In versions after 4.1, we disable resumable bootstrap by default (see 
CASSANDRA-17679). In order to run
++        nodetool boostrap resume in these subsequent versions we have to 
manually indicate the intent to allow resumability.
++        """
++        nt_resume_cmd = 'bootstrap resume'
++        if cluster.version() >= '4.2':
++            nt_resume_cmd += ' -f'
++        return nt_resume_cmd
++
+     @since('4.0')
+     @pytest.mark.no_vnodes
+     def test_simple_bootstrap_with_everywhere_strategy(self):
+@@ -1068,19 +1078,6 @@
+         assert_almost_equal(size1, size2, error=0.3)
+ 
+         assert_bootstrap_state(self, node2, 'COMPLETED')
+-=======
+-    @staticmethod
+-    def nodetool_resume_command(cluster):
+-        """
+-        In versions after 4.1, we disable resumable bootstrap by default (see 
CASSANDRA-17679). In order to run
+-        nodetool boostrap resume in these subsequent versions we have to 
manually indicate the intent to allow resumability.
+-        """
+-        nt_resume_cmd = 'bootstrap resume'
+-        if cluster.version() >= '4.2':
+-            nt_resume_cmd += ' -f'
+-        return nt_resume_cmd
+-
+->>>>>>>
+ 
+ class TestBootstrap(BootstrapTester):
+     """


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to