|
| 1 | +--- a/bootstrap_test.py |
| 2 | ++++ b/bootstrap_test.py |
| 3 | +@@ -1018,58 +1018,6 @@ |
| 4 | + assert_bootstrap_state(self, node3, 'COMPLETED', user='cassandra', password='cassandra') |
| 5 | + node3.wait_for_binary_interface() |
| 6 | + |
| 7 | +-<<<<<<< |
| 8 | +- @since('4.0') |
| 9 | +- @pytest.mark.no_vnodes |
| 10 | +- def test_simple_bootstrap_with_everywhere_strategy(self): |
| 11 | +- cluster = self.cluster |
| 12 | +- tokens = cluster.balanced_tokens(2) |
| 13 | +- cluster.set_configuration_options(values={'num_tokens': 1}) |
| 14 | +- |
| 15 | +- logger.debug("[node1, node2] tokens: %r" % (tokens,)) |
| 16 | +- |
| 17 | +- keys = 10000 |
| 18 | +- |
| 19 | +- # Create a single node cluster |
| 20 | +- cluster.populate(1) |
| 21 | +- node1 = cluster.nodelist()[0] |
| 22 | +- node1.set_configuration_options(values={'initial_token': tokens[0]}) |
| 23 | +- cluster.start() |
| 24 | +- |
| 25 | +- session = self.patient_cql_connection(node1) |
| 26 | +- create_ks(session, 'ks', 'EverywhereStrategy') |
| 27 | +- create_cf(session, 'cf', columns={'c1': 'text', 'c2': 'text'}) |
| 28 | +- |
| 29 | +- insert_statement = session.prepare("INSERT INTO ks.cf (key, c1, c2) VALUES (?, 'value1', 'value2')") |
| 30 | +- execute_concurrent_with_args(session, insert_statement, [['k%d' % k] for k in range(keys)]) |
| 31 | +- |
| 32 | +- node1.flush() |
| 33 | +- node1.compact() |
| 34 | +- |
| 35 | +- # Reads inserted data all during the bootstrap process. We shouldn't |
| 36 | +- # get any error |
| 37 | +- query_c1c2(session, random.randint(0, keys - 1), ConsistencyLevel.ONE) |
| 38 | +- session.shutdown() |
| 39 | +- |
| 40 | +- # Bootstrapping a new node in the current version |
| 41 | +- node2 = new_node(cluster) |
| 42 | +- node2.set_configuration_options(values={'initial_token': tokens[1]}) |
| 43 | +- node2.start(wait_for_binary_proto=True) |
| 44 | +- node2.compact() |
| 45 | +- |
| 46 | +- node1.cleanup() |
| 47 | +- logger.debug("node1 size for ks.cf after cleanup: %s" % float(data_size(node1,'ks','cf'))) |
| 48 | +- node1.compact() |
| 49 | +- logger.debug("node1 size for ks.cf after compacting: %s" % float(data_size(node1,'ks','cf'))) |
| 50 | +- |
| 51 | +- logger.debug("node2 size for ks.cf after compacting: %s" % float(data_size(node2,'ks','cf'))) |
| 52 | +- |
| 53 | +- size1 = float(data_size(node1,'ks','cf')) |
| 54 | +- size2 = float(data_size(node2,'ks','cf')) |
| 55 | +- assert_almost_equal(size1, size2, error=0.3) |
| 56 | +- |
| 57 | +- assert_bootstrap_state(self, node2, 'COMPLETED') |
| 58 | +-======= |
| 59 | + @since('4.1') |
| 60 | + def test_invalid_host_id(self): |
| 61 | + """ |
| 62 | +@@ -1149,4 +1097,54 @@ |
| 63 | + # 3. check host_id in other node's table |
| 64 | + session1 = self.patient_exclusive_cql_connection(node1) |
| 65 | + assert_one(session1, "SELECT host_id FROM system.peers_v2 WHERE peer = {}".format(address2), [uuid.UUID(host_id)]) |
| 66 | +->>>>>>> |
| 67 | ++ |
| 68 | ++ @since('4.0') |
| 69 | ++ @pytest.mark.no_vnodes |
| 70 | ++ def test_simple_bootstrap_with_everywhere_strategy(self): |
| 71 | ++ cluster = self.cluster |
| 72 | ++ tokens = cluster.balanced_tokens(2) |
| 73 | ++ cluster.set_configuration_options(values={'num_tokens': 1}) |
| 74 | ++ |
| 75 | ++ logger.debug("[node1, node2] tokens: %r" % (tokens,)) |
| 76 | ++ |
| 77 | ++ keys = 10000 |
| 78 | ++ |
| 79 | ++ # Create a single node cluster |
| 80 | ++ cluster.populate(1) |
| 81 | ++ node1 = cluster.nodelist()[0] |
| 82 | ++ node1.set_configuration_options(values={'initial_token': tokens[0]}) |
| 83 | ++ cluster.start() |
| 84 | ++ |
| 85 | ++ session = self.patient_cql_connection(node1) |
| 86 | ++ create_ks(session, 'ks', 'EverywhereStrategy') |
| 87 | ++ create_cf(session, 'cf', columns={'c1': 'text', 'c2': 'text'}) |
| 88 | ++ |
| 89 | ++ insert_statement = session.prepare("INSERT INTO ks.cf (key, c1, c2) VALUES (?, 'value1', 'value2')") |
| 90 | ++ execute_concurrent_with_args(session, insert_statement, [['k%d' % k] for k in range(keys)]) |
| 91 | ++ |
| 92 | ++ node1.flush() |
| 93 | ++ node1.compact() |
| 94 | ++ |
| 95 | ++ # Reads inserted data all during the bootstrap process. We shouldn't |
| 96 | ++ # get any error |
| 97 | ++ query_c1c2(session, random.randint(0, keys - 1), ConsistencyLevel.ONE) |
| 98 | ++ session.shutdown() |
| 99 | ++ |
| 100 | ++ # Bootstrapping a new node in the current version |
| 101 | ++ node2 = new_node(cluster) |
| 102 | ++ node2.set_configuration_options(values={'initial_token': tokens[1]}) |
| 103 | ++ node2.start(wait_for_binary_proto=True) |
| 104 | ++ node2.compact() |
| 105 | ++ |
| 106 | ++ node1.cleanup() |
| 107 | ++ logger.debug("node1 size for ks.cf after cleanup: %s" % float(data_size(node1,'ks','cf'))) |
| 108 | ++ node1.compact() |
| 109 | ++ logger.debug("node1 size for ks.cf after compacting: %s" % float(data_size(node1,'ks','cf'))) |
| 110 | ++ |
| 111 | ++ logger.debug("node2 size for ks.cf after compacting: %s" % float(data_size(node2,'ks','cf'))) |
| 112 | ++ |
| 113 | ++ size1 = float(data_size(node1,'ks','cf')) |
| 114 | ++ size2 = float(data_size(node2,'ks','cf')) |
| 115 | ++ assert_almost_equal(size1, size2, error=0.3) |
| 116 | ++ |
| 117 | ++ assert_bootstrap_state(self, node2, 'COMPLETED') |
0 commit comments