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

samt pushed a commit to branch cep-21-tcm
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit 6ca34e62f2b51fd553098ab592b33d5fd5fbff3a
Author: Sam Tunnicliffe <[email protected]>
AuthorDate: Wed Mar 22 11:00:09 2023 +0000

    [CEP-21] Various fixes to in-jvm dtests
    
    * JVMDTestTest
        schema change with stopped node, must not be CMS
    * SSTableIdGenerationTest
        This test revolves around creating sstables with sequential ids, then
        restarting the node after enabling sstable uuids, creating more sstables
        and then counting the number of each type of sstable. It seems to rely
        on the local host id being unavailable when the node restarts, which
        causes the mutations in the commitlog, which have already been flushed
        to be replayed as the null local host id doesn't match the actual one in
        the sstable metadata. In turn this leads to an extra sstable being
        created after the restart, duplicating (some of) what was in the earlier
        sstables.
    * MigrationCoordinatorTest
        deleted
    
    patch by Sam Tunnicliffe; reviewed by Alex Petrov and Marcus Eriksson
    for CASSANDRA-18405
---
 .../cassandra/distributed/test/JVMDTestTest.java   |   8 +-
 .../distributed/test/MigrationCoordinatorTest.java | 128 ---------------------
 2 files changed, 6 insertions(+), 130 deletions(-)

diff --git 
a/test/distributed/org/apache/cassandra/distributed/test/JVMDTestTest.java 
b/test/distributed/org/apache/cassandra/distributed/test/JVMDTestTest.java
index f11ad16bb7..c764df16bf 100644
--- a/test/distributed/org/apache/cassandra/distributed/test/JVMDTestTest.java
+++ b/test/distributed/org/apache/cassandra/distributed/test/JVMDTestTest.java
@@ -173,9 +173,13 @@ public class JVMDTestTest extends TestBaseImpl
             assertRows(cluster.get(2).executeInternal("SELECT table_name FROM 
system_schema.tables WHERE keyspace_name = ?", KEYSPACE),
                        row("tbl1"), row("tbl2"), row("tbl3"));
 
-            // Finally test schema can be changed with the first node down
-            cluster.get(1).shutdown(true).get(1, TimeUnit.MINUTES);
+            // Finally test schema can be changed with the non-CMS node down
+            cluster.get(2).shutdown(true).get(1, TimeUnit.MINUTES);
             cluster.schemaChangeIgnoringStoppedInstances("CREATE TABLE 
"+KEYSPACE+".tbl4 (id int primary key, i int)");
+            assertRows(cluster.get(1).executeInternal("SELECT table_name FROM 
system_schema.tables WHERE keyspace_name = ?", KEYSPACE),
+                       row("tbl1"), row("tbl2"), row("tbl3"), row("tbl4"));
+            // Restart the down node and check it catches up with the new 
schema
+            cluster.get(2).startup();
             assertRows(cluster.get(2).executeInternal("SELECT table_name FROM 
system_schema.tables WHERE keyspace_name = ?", KEYSPACE),
                        row("tbl1"), row("tbl2"), row("tbl3"), row("tbl4"));
         }
diff --git 
a/test/distributed/org/apache/cassandra/distributed/test/MigrationCoordinatorTest.java
 
b/test/distributed/org/apache/cassandra/distributed/test/MigrationCoordinatorTest.java
deleted file mode 100644
index 155a41cea2..0000000000
--- 
a/test/distributed/org/apache/cassandra/distributed/test/MigrationCoordinatorTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.cassandra.distributed.test;
-
-import java.net.InetAddress;
-import java.util.UUID;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.cassandra.distributed.Cluster;
-import org.apache.cassandra.distributed.api.IInstanceConfig;
-import org.apache.cassandra.distributed.api.TokenSupplier;
-import org.apache.cassandra.distributed.shared.NetworkTopology;
-import org.apache.cassandra.schema.Schema;
-
-import static 
org.apache.cassandra.config.CassandraRelevantProperties.IGNORED_SCHEMA_CHECK_ENDPOINTS;
-import static 
org.apache.cassandra.config.CassandraRelevantProperties.IGNORED_SCHEMA_CHECK_VERSIONS;
-import static org.apache.cassandra.distributed.api.Feature.GOSSIP;
-import static org.apache.cassandra.distributed.api.Feature.NETWORK;
-
-public class MigrationCoordinatorTest extends TestBaseImpl
-{
-
-    @Before
-    public void setUp()
-    {
-        System.clearProperty("cassandra.replace_address");
-        System.clearProperty("cassandra.consistent.rangemovement");
-
-        System.clearProperty(IGNORED_SCHEMA_CHECK_VERSIONS.getKey());
-        System.clearProperty(IGNORED_SCHEMA_CHECK_VERSIONS.getKey());
-    }
-    /**
-     * We shouldn't wait on versions only available from a node being replaced
-     * see CASSANDRA-
-     */
-    @Test
-    public void replaceNode() throws Throwable
-    {
-
-        Assert.fail("Causes build to hang and probably no longer necessary");
-        try (Cluster cluster = Cluster.build(2)
-                                      
.withTokenSupplier(TokenSupplier.evenlyDistributedTokens(3))
-                                      
.withNodeIdTopology(NetworkTopology.singleDcNetworkTopology(3, "dc0", "rack0"))
-                                      .withConfig(config -> 
config.with(NETWORK, GOSSIP))
-                                      .start())
-        {
-            cluster.schemaChange("CREATE KEYSPACE ks with 
replication={'class':'SimpleStrategy', 'replication_factor':2}");
-            InetAddress replacementAddress = 
cluster.get(2).broadcastAddress().getAddress();
-            cluster.get(2).shutdown(false);
-            cluster.schemaChangeIgnoringStoppedInstances("CREATE TABLE ks.tbl 
(k int primary key, v int)");
-
-            IInstanceConfig config = cluster.newInstanceConfig();
-            config.set("auto_bootstrap", true);
-            System.setProperty("cassandra.replace_address", 
replacementAddress.getHostAddress());
-            cluster.bootstrap(config).startup();
-        }
-    }
-
-    @Test
-    public void explicitEndpointIgnore() throws Throwable
-    {
-        Assert.fail("Causes build to hang and probably no longer necessary");
-        try (Cluster cluster = Cluster.build(2)
-                                      
.withTokenSupplier(TokenSupplier.evenlyDistributedTokens(3))
-                                      
.withNodeIdTopology(NetworkTopology.singleDcNetworkTopology(3, "dc0", "rack0"))
-                                      .withConfig(config -> 
config.with(NETWORK, GOSSIP))
-                                      .start())
-        {
-            cluster.schemaChange("CREATE KEYSPACE ks with 
replication={'class':'SimpleStrategy', 'replication_factor':2}");
-            InetAddress ignoredEndpoint = 
cluster.get(2).broadcastAddress().getAddress();
-            cluster.get(2).shutdown(false);
-            cluster.schemaChangeIgnoringStoppedInstances("CREATE TABLE ks.tbl 
(k int primary key, v int)");
-
-            IInstanceConfig config = cluster.newInstanceConfig();
-            config.set("auto_bootstrap", true);
-            
IGNORED_SCHEMA_CHECK_ENDPOINTS.setString(ignoredEndpoint.getHostAddress());
-            System.setProperty("cassandra.consistent.rangemovement", "false");
-            cluster.bootstrap(config).startup();
-        }
-    }
-
-    @Test
-    public void explicitVersionIgnore() throws Throwable
-    {
-        Assert.fail("Causes build to hang and probably no longer necessary");
-        try (Cluster cluster = Cluster.build(2)
-                                      
.withTokenSupplier(TokenSupplier.evenlyDistributedTokens(3))
-                                      
.withNodeIdTopology(NetworkTopology.singleDcNetworkTopology(3, "dc0", "rack0"))
-                                      .withConfig(config -> 
config.with(NETWORK, GOSSIP))
-                                      .start())
-        {
-            UUID initialVersion = cluster.get(2).callsOnInstance(() -> 
Schema.instance.getVersion()).call();
-            cluster.schemaChange("CREATE KEYSPACE ks with 
replication={'class':'SimpleStrategy', 'replication_factor':2}");
-            UUID oldVersion;
-            do
-            {
-                oldVersion = cluster.get(2).callsOnInstance(() -> 
Schema.instance.getVersion()).call();
-            } while (oldVersion.equals(initialVersion));
-            cluster.get(2).shutdown(false);
-            cluster.schemaChangeIgnoringStoppedInstances("CREATE TABLE ks.tbl 
(k int primary key, v int)");
-
-            IInstanceConfig config = cluster.newInstanceConfig();
-            config.set("auto_bootstrap", true);
-            IGNORED_SCHEMA_CHECK_VERSIONS.setString(initialVersion.toString() 
+ ',' + oldVersion);
-            System.setProperty("cassandra.consistent.rangemovement", "false");
-            cluster.bootstrap(config).startup();
-        }
-    }
-}


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

Reply via email to