You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by mc...@apache.org on 2020/12/16 17:06:20 UTC

[cassandra-dtest] branch trunk updated: Use the token allocation strategy generator tool for 4.0 vnode clusters, from CASSANDRA-16205

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

mck pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 7ba3bdd  Use the token allocation strategy generator tool for 4.0 vnode clusters, from CASSANDRA-16205
7ba3bdd is described below

commit 7ba3bdd88cce56c0bf33b3288e2de3a9a241b5c4
Author: Mick Semb Wever <mc...@apache.org>
AuthorDate: Sun Nov 15 17:14:15 2020 +0100

    Use the token allocation strategy generator tool for 4.0 vnode clusters, from CASSANDRA-16205
    
     patch by Mick Semb Wever; reviewed by Adam Holmberg, Paulo Motta for CASSANDRA-16079
---
 bootstrap_test.py                 | 16 ++++++++++++++++
 client_network_stop_start_test.py |  1 +
 consistency_test.py               | 12 ++----------
 cqlsh_tests/test_cqlsh_copy.py    |  6 ++++++
 disk_balance_test.py              |  3 ++-
 dtest_setup.py                    |  3 +--
 hintedhandoff_test.py             |  7 +------
 pushed_notifications_test.py      |  4 ++--
 replace_address_test.py           |  5 -----
 9 files changed, 31 insertions(+), 26 deletions(-)

diff --git a/bootstrap_test.py b/bootstrap_test.py
index 3db8eab..599bf66 100644
--- a/bootstrap_test.py
+++ b/bootstrap_test.py
@@ -206,6 +206,7 @@ class TestBootstrap(Tester):
         Test that bootstrap completes if streaming from nodes with no data
         """
         cluster = self.cluster
+        cluster.set_environment_variable('CASSANDRA_TOKEN_PREGENERATION_DISABLED', 'True')
         # Create a two-node cluster
         cluster.populate(2)
         cluster.start()
@@ -222,6 +223,7 @@ class TestBootstrap(Tester):
         @jira_ticket CASSANDRA-6648
         """
         cluster = self.cluster
+        cluster.set_environment_variable('CASSANDRA_TOKEN_PREGENERATION_DISABLED', 'True')
         cluster.populate(3)
         cluster.start()
 
@@ -246,6 +248,7 @@ class TestBootstrap(Tester):
              """
 
              cluster = self.cluster
+             cluster.set_environment_variable('CASSANDRA_TOKEN_PREGENERATION_DISABLED', 'True')
 
              logger.debug("Create a cluster")
              cluster.populate(1)
@@ -283,6 +286,7 @@ class TestBootstrap(Tester):
         @jira_ticket CASSANDRA-11848
         """
         cluster = self.cluster
+        cluster.set_environment_variable('CASSANDRA_TOKEN_PREGENERATION_DISABLED', 'True')
 
         cluster.populate(2)
         node1, node2 = cluster.nodelist()
@@ -341,6 +345,7 @@ class TestBootstrap(Tester):
         Test resuming bootstrap after data streaming failure
         """
         cluster = self.cluster
+        cluster.set_environment_variable('CASSANDRA_TOKEN_PREGENERATION_DISABLED', 'True')
         cluster.populate(2)
 
         node1 = cluster.nodes['node1']
@@ -383,6 +388,7 @@ class TestBootstrap(Tester):
     def test_bootstrap_with_reset_bootstrap_state(self):
         """Test bootstrap with resetting bootstrap progress"""
         cluster = self.cluster
+        cluster.set_environment_variable('CASSANDRA_TOKEN_PREGENERATION_DISABLED', 'True')
         cluster.set_configuration_options(values={'stream_throughput_outbound_megabits_per_sec': 1})
         cluster.populate(2).start()
 
@@ -422,6 +428,7 @@ class TestBootstrap(Tester):
             @jira_ticket CASSANDRA-9022
         """
         cluster = self.cluster
+        cluster.set_environment_variable('CASSANDRA_TOKEN_PREGENERATION_DISABLED', 'True')
         cluster.populate(2).start()
         (node1, node2) = cluster.nodelist()
 
@@ -448,6 +455,7 @@ class TestBootstrap(Tester):
         @jira_ticket CASSANDRA-8058
         """
         cluster = self.cluster
+        cluster.set_environment_variable('CASSANDRA_TOKEN_PREGENERATION_DISABLED', 'True')
         cluster.populate([1, 1])
         cluster.start()
 
@@ -520,6 +528,7 @@ class TestBootstrap(Tester):
         the gently parameter.
         """
         cluster = self.cluster
+        cluster.set_environment_variable('CASSANDRA_TOKEN_PREGENERATION_DISABLED', 'True')
         cluster.populate(3)
         cluster.start()
 
@@ -553,6 +562,7 @@ class TestBootstrap(Tester):
         Test that if we decommission a node and then wipe its data, it can join the cluster.
         """
         cluster = self.cluster
+        cluster.set_environment_variable('CASSANDRA_TOKEN_PREGENERATION_DISABLED', 'True')
         cluster.populate(3)
         cluster.start()
 
@@ -589,6 +599,7 @@ class TestBootstrap(Tester):
         seed node.
         """
         cluster = self.cluster
+        cluster.set_environment_variable('CASSANDRA_TOKEN_PREGENERATION_DISABLED', 'True')
         cluster.populate(1)
         cluster.start()
 
@@ -631,6 +642,7 @@ class TestBootstrap(Tester):
         Test that if a node fails to bootstrap, it can join the cluster even if the data is wiped.
         """
         cluster = self.cluster
+        cluster.set_environment_variable('CASSANDRA_TOKEN_PREGENERATION_DISABLED', 'True')
         cluster.populate(1)
         cluster.set_configuration_options(values={'stream_throughput_outbound_megabits_per_sec': 1})
         cluster.start()
@@ -670,6 +682,7 @@ class TestBootstrap(Tester):
         Test that a node cannot bootstrap without replace_address if a hibernating node exists with that address
         """
         cluster = self.cluster
+        cluster.set_environment_variable('CASSANDRA_TOKEN_PREGENERATION_DISABLED', 'True')
         cluster.populate(2)
         # Setting seed node to first node to make sure replaced node is not in own seed list
         cluster.set_configuration_options({
@@ -763,6 +776,7 @@ class TestBootstrap(Tester):
                           " cannot bootstrap while cassandra.consistent.rangemovement is true"
 
         cluster = self.cluster
+        cluster.set_environment_variable('CASSANDRA_TOKEN_PREGENERATION_DISABLED', 'True')
         cluster.populate(1)
         cluster.start()
 
@@ -805,6 +819,7 @@ class TestBootstrap(Tester):
         Make sure we remove processed files during cleanup
         """
         cluster = self.cluster
+        cluster.set_environment_variable('CASSANDRA_TOKEN_PREGENERATION_DISABLED', 'True')
         cluster.set_configuration_options(values={'concurrent_compactors': 4})
         cluster.populate(1)
         cluster.start()
@@ -866,6 +881,7 @@ class TestBootstrap(Tester):
                   'roles_validity_in_ms': 0}
 
         cluster = self.cluster
+        cluster.set_environment_variable('CASSANDRA_TOKEN_PREGENERATION_DISABLED', 'True')
         cluster.populate(1)
 
         node1 = cluster.nodes['node1']
diff --git a/client_network_stop_start_test.py b/client_network_stop_start_test.py
index 6f472df..bc95ca5 100644
--- a/client_network_stop_start_test.py
+++ b/client_network_stop_start_test.py
@@ -64,6 +64,7 @@ class TestClientNetworkStopStart(Tester):
         """Tests default configurations have the correct client network setup"""
         cluster = self.cluster
         logger.debug("Starting cluster..")
+        cluster.set_environment_variable('CASSANDRA_TOKEN_PREGENERATION_DISABLED', 'True')
         cluster.populate(1).start(wait_for_binary_proto=True)
         self._assert_binary_actually_found(cluster)
         self._assert_startup(cluster)
diff --git a/consistency_test.py b/consistency_test.py
index 2c9f868..c974b9e 100644
--- a/consistency_test.py
+++ b/consistency_test.py
@@ -1505,11 +1505,7 @@ class TestConsistency(Tester):
         cluster = self.cluster
         cluster.set_configuration_options(values={'hinted_handoff_enabled': False})
 
-        if not self.dtest_config.use_vnodes:
-            cluster.populate(2).start()
-        else:
-            tokens = cluster.balanced_tokens(2)
-            cluster.populate(2, tokens=tokens).start()
+        cluster.populate(2).start()
         node1, node2 = cluster.nodelist()
 
         session = self.patient_cql_connection(node1)
@@ -1542,11 +1538,7 @@ class TestConsistency(Tester):
 
         logger.debug("Creating a ring")
         cluster = self.cluster
-        if not self.dtest_config.use_vnodes:
-            cluster.populate(3).start()
-        else:
-            tokens = cluster.balanced_tokens(3)
-            cluster.populate(3, tokens=tokens).start()
+        cluster.populate(3).start()
         node1, node2, node3 = cluster.nodelist()
 
         logger.debug("Set to talk to node 2")
diff --git a/cqlsh_tests/test_cqlsh_copy.py b/cqlsh_tests/test_cqlsh_copy.py
index 88ecf44..e78cf6d 100644
--- a/cqlsh_tests/test_cqlsh_copy.py
+++ b/cqlsh_tests/test_cqlsh_copy.py
@@ -99,6 +99,12 @@ class TestCqlshCopy(Tester):
                 else:
                     configuration_options['authenticator'] = 'org.apache.cassandra.auth.PasswordAuthenticator'
 
+            if self.cluster.cassandra_version() >= '4' and not ('Murmur3' in p or 'Random' in p):
+                if configuration_options is None:
+                    configuration_options = {'allocate_tokens_for_local_replication_factor': None}
+                else:
+                    configuration_options['allocate_tokens_for_local_replication_factor'] = None
+
             if configuration_options:
                 self.cluster.set_configuration_options(values=configuration_options)
             self.cluster.populate(nodes, tokens=tokens).start()
diff --git a/disk_balance_test.py b/disk_balance_test.py
index 1ff16a4..bfd3d8e 100644
--- a/disk_balance_test.py
+++ b/disk_balance_test.py
@@ -248,8 +248,9 @@ class TestDiskBalance(Tester):
         logger.debug("Bootstrap node2 and flush")
         # Fixed initial token to bisect the ring and make sure the nodes are balanced (otherwise a random token is generated).
         balanced_tokens = cluster.balanced_tokens(2)
-        assert balanced_tokens[0] == node1.initial_token  # make sure cluster population still works as assumed
+        assert self.dtest_config.use_vnodes or balanced_tokens[0] == node1.initial_token  # make sure cluster population still works as assumed
         node2 = new_node(cluster, token=balanced_tokens[1], bootstrap=True)
+        node2.set_configuration_options(values={'num_tokens': 1})
         node2.start(wait_for_binary_proto=True, jvm_args=["-Dcassandra.migration_task_wait_in_seconds=10"], set_migration_task=False)
         node2.flush()
 
diff --git a/dtest_setup.py b/dtest_setup.py
index 23d7531..b3f4838 100644
--- a/dtest_setup.py
+++ b/dtest_setup.py
@@ -420,8 +420,7 @@ class DTestSetup(object):
             values['corrupted_tombstone_strategy'] = 'exception'
 
         if self.dtest_config.use_vnodes:
-            self.cluster.set_configuration_options(
-                values={'initial_token': None, 'num_tokens': self.dtest_config.num_tokens})
+            self.cluster.set_configuration_options(values={'num_tokens': self.dtest_config.num_tokens})
         else:
             self.cluster.set_configuration_options(values={'num_tokens': 1})
 
diff --git a/hintedhandoff_test.py b/hintedhandoff_test.py
index 485edcc..60d55fd 100644
--- a/hintedhandoff_test.py
+++ b/hintedhandoff_test.py
@@ -31,12 +31,7 @@ class TestHintedHandoffConfig(Tester):
         if config_options:
             cluster.set_configuration_options(values=config_options)
 
-        if not self.dtest_config.use_vnodes:
-            cluster.populate([2]).start()
-        else:
-            tokens = cluster.balanced_tokens(2)
-            cluster.populate([2], tokens=tokens).start()
-
+        cluster.populate([2]).start()
         return cluster.nodelist()
 
     def _launch_nodetool_cmd(self, node, cmd):
diff --git a/pushed_notifications_test.py b/pushed_notifications_test.py
index 6ee6d28..8f235a4 100644
--- a/pushed_notifications_test.py
+++ b/pushed_notifications_test.py
@@ -281,7 +281,7 @@ class TestPushedNotifications(Tester):
         self.cluster.add(node2, False)
         node2.start()
         logger.debug("Waiting for notifications from {}".format(waiter.address))
-        notifications = waiter.wait_for_notifications(timeout=60.0, num_notifications=2)
+        notifications = waiter.wait_for_notifications(timeout=120.0, num_notifications=2)
         assert 2 == len(notifications), notifications
         for notification in notifications:
             assert get_ip_from_node(node2) == notification["address"][0]
@@ -293,7 +293,7 @@ class TestPushedNotifications(Tester):
         node2.decommission()
         node2.stop(gently=False)
         logger.debug("Waiting for notifications from {}".format(waiter.address))
-        notifications = waiter.wait_for_notifications(timeout=60.0, num_notifications=2)
+        notifications = waiter.wait_for_notifications(timeout=120.0, num_notifications=2)
         assert 2 == len(notifications), notifications
         for notification in notifications:
             assert get_ip_from_node(node2) == notification["address"][0]
diff --git a/replace_address_test.py b/replace_address_test.py
index 18a94ae..2fa76f9 100644
--- a/replace_address_test.py
+++ b/replace_address_test.py
@@ -53,11 +53,6 @@ class BaseReplaceAddressTest(Tester):
         self.replaced_node = self.cluster.nodelist()[-1]
 
         self.cluster.seeds.remove(self.replaced_node)
-        NUM_TOKENS = os.environ.get('NUM_TOKENS', '256')
-        if not self.dtest_config.use_vnodes:
-            self.cluster.set_configuration_options(values={'initial_token': None, 'num_tokens': 1})
-        else:
-            self.cluster.set_configuration_options(values={'initial_token': None, 'num_tokens': NUM_TOKENS})
 
         if enable_byteman:
             # set up byteman


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org