From 302c6fcf59c5fa9fcd475b2c811ad57ae7c45f49 Mon Sep 17 00:00:00 2001 From: Caleb Rackliffe Date: Thu, 10 Mar 2022 17:12:47 -0600 Subject: [PATCH] Update SUPPORTED_UPGRADE_PATHS to include 3.0 and 3.x to 4.1 paths and remove obsolete tests patch by Caleb Rackliffe; reviewed by Mick Semb Wever for CASSANDRA-17362 --- CHANGES.txt | 1 + .../upgrade/MixedModeAvailabilityV22Test.java | 41 -------- .../upgrade/MixedModeConsistencyV22Test.java | 41 -------- .../MixedModeFrom2LoggedBatchTest.java | 38 -------- .../MixedModeFrom2ReplicationTest.java | 38 -------- .../MixedModeFrom2UnloggedBatchTest.java | 38 -------- .../distributed/upgrade/PagingTest.java | 96 ------------------- .../ReadRepairCompactStorageUpgradeTest.java | 57 ----------- .../distributed/upgrade/UpgradeTestBase.java | 10 +- 9 files changed, 4 insertions(+), 356 deletions(-) delete mode 100644 test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeAvailabilityV22Test.java delete mode 100644 test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeConsistencyV22Test.java delete mode 100644 test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeFrom2LoggedBatchTest.java delete mode 100644 test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeFrom2ReplicationTest.java delete mode 100644 test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeFrom2UnloggedBatchTest.java delete mode 100644 test/distributed/org/apache/cassandra/distributed/upgrade/PagingTest.java delete mode 100644 test/distributed/org/apache/cassandra/distributed/upgrade/ReadRepairCompactStorageUpgradeTest.java diff --git a/CHANGES.txt b/CHANGES.txt index 8ed2fcf54f..09f352c3ac 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 4.1 + * Update SUPPORTED_UPGRADE_PATHS to include 3.0 and 3.x to 4.1 paths and remove obsolete tests (CASSANDRA-17362) * Support DELETE in CQLSSTableWriter (CASSANDRA-14797) * Failed inbound internode authentication failures generate ugly warning with stack trace (CASSANDRA-17068) * Expose gossip information in system_views.gossip_info virtual table (CASSANDRA-17002) diff --git a/test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeAvailabilityV22Test.java b/test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeAvailabilityV22Test.java deleted file mode 100644 index f75657493f..0000000000 --- a/test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeAvailabilityV22Test.java +++ /dev/null @@ -1,41 +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.upgrade; - -import org.junit.Test; - -import org.apache.cassandra.distributed.shared.Versions; - -/** - * {@link MixedModeAvailabilityTestBase} for upgrades from v22. - */ -public class MixedModeAvailabilityV22Test extends MixedModeAvailabilityTestBase -{ - @Test - public void testAvailabilityV22ToV30() throws Throwable - { - testAvailability(v22, v30); - } - - @Test - public void testAvailabilityV22ToV3X() throws Throwable - { - testAvailability(v22, v3X); - } -} diff --git a/test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeConsistencyV22Test.java b/test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeConsistencyV22Test.java deleted file mode 100644 index deb0863da2..0000000000 --- a/test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeConsistencyV22Test.java +++ /dev/null @@ -1,41 +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.upgrade; - -import org.junit.Test; - -import org.apache.cassandra.distributed.shared.Versions; - -/** - * {@link MixedModeConsistencyTestBase} for upgrades from v22. - */ -public class MixedModeConsistencyV22Test extends MixedModeConsistencyTestBase -{ - @Test - public void testConsistencyV22ToV30() throws Throwable - { - testConsistency(v22, v30); - } - - @Test - public void testConsistencyV22ToV3X() throws Throwable - { - testConsistency(v22, v3X); - } -} diff --git a/test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeFrom2LoggedBatchTest.java b/test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeFrom2LoggedBatchTest.java deleted file mode 100644 index 3835521378..0000000000 --- a/test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeFrom2LoggedBatchTest.java +++ /dev/null @@ -1,38 +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.upgrade; - -import org.junit.Test; - -import org.apache.cassandra.distributed.shared.Versions; - -public class MixedModeFrom2LoggedBatchTest extends MixedModeBatchTestBase -{ - @Test - public void testSimpleStrategy22to30() throws Throwable - { - testSimpleStrategy(v22, v30, true); - } - - @Test - public void testSimpleStrategy22to3X() throws Throwable - { - testSimpleStrategy(v22, v3X, true); - } -} \ No newline at end of file diff --git a/test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeFrom2ReplicationTest.java b/test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeFrom2ReplicationTest.java deleted file mode 100644 index ea56415ef7..0000000000 --- a/test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeFrom2ReplicationTest.java +++ /dev/null @@ -1,38 +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.upgrade; - -import org.junit.Test; - -import org.apache.cassandra.distributed.shared.Versions; - -public class MixedModeFrom2ReplicationTest extends MixedModeReplicationTestBase -{ - @Test - public void testSimpleStrategy22to30() throws Throwable - { - testSimpleStrategy(v22, v30); - } - - @Test - public void testSimpleStrategy22to3X() throws Throwable - { - testSimpleStrategy(v22, v3X); - } -} diff --git a/test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeFrom2UnloggedBatchTest.java b/test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeFrom2UnloggedBatchTest.java deleted file mode 100644 index 4f4b722fa0..0000000000 --- a/test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeFrom2UnloggedBatchTest.java +++ /dev/null @@ -1,38 +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.upgrade; - -import org.junit.Test; - -import org.apache.cassandra.distributed.shared.Versions; - -public class MixedModeFrom2UnloggedBatchTest extends MixedModeBatchTestBase -{ - @Test - public void testSimpleStrategy22to30() throws Throwable - { - testSimpleStrategy(v22, v30, false); - } - - @Test - public void testSimpleStrategy22to3X() throws Throwable - { - testSimpleStrategy(v22, v3X, false); - } -} diff --git a/test/distributed/org/apache/cassandra/distributed/upgrade/PagingTest.java b/test/distributed/org/apache/cassandra/distributed/upgrade/PagingTest.java deleted file mode 100644 index 30e248d2b2..0000000000 --- a/test/distributed/org/apache/cassandra/distributed/upgrade/PagingTest.java +++ /dev/null @@ -1,96 +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.upgrade; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import org.junit.Test; - -import com.datastax.driver.core.ProtocolVersion; -import com.datastax.driver.core.QueryOptions; -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.Row; -import com.datastax.driver.core.Session; -import com.datastax.driver.core.SimpleStatement; -import com.datastax.driver.core.Statement; -import org.apache.cassandra.distributed.api.ConsistencyLevel; -import org.apache.cassandra.distributed.shared.DistributedTestBase; -import org.apache.cassandra.distributed.shared.Versions; - -import static org.apache.cassandra.distributed.api.Feature.GOSSIP; -import static org.apache.cassandra.distributed.api.Feature.NATIVE_PROTOCOL; -import static org.apache.cassandra.distributed.api.Feature.NETWORK; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -public class PagingTest extends UpgradeTestBase -{ - @Test - public void testReads() throws Throwable - { - new UpgradeTestBase.TestCase() - .nodes(2) - .upgrades(v22, v30) - .nodesToUpgrade(2) - .withConfig(config -> config.with(GOSSIP, NETWORK, NATIVE_PROTOCOL)) - .setup((cluster) -> { - cluster.disableAutoCompaction(DistributedTestBase.KEYSPACE); - cluster.schemaChange("CREATE TABLE " + DistributedTestBase.KEYSPACE + ".tbl (pk int, ck int, v text, PRIMARY KEY (pk, ck)) "); - for (int j = 0; j < 5000; j++) - { - for (int i = 0; i < 10; i++) - cluster.coordinator(1).execute("insert into " + DistributedTestBase.KEYSPACE + ".tbl (pk, ck, v) VALUES (" + j + ", " + i + ", 'hello')", ConsistencyLevel.ALL); - } - cluster.forEach(c -> c.flush(DistributedTestBase.KEYSPACE)); - checkDuplicates("BOTH ON 2.2"); - }) - .runAfterClusterUpgrade((cluster) -> checkDuplicates("MIXED MODE")) - .run(); - } - - private void checkDuplicates(String message) throws InterruptedException - { - Thread.sleep(5000); // sometimes one node doesn't have time come up properly? - try (com.datastax.driver.core.Cluster c = com.datastax.driver.core.Cluster.builder() - .addContactPoint("127.0.0.1") - .withProtocolVersion(ProtocolVersion.V3) - .withQueryOptions(new QueryOptions().setFetchSize(101)) - .build(); - Session s = c.connect()) - { - Statement stmt = new SimpleStatement("select distinct token(pk) from " + DistributedTestBase.KEYSPACE + ".tbl WHERE token(pk) > " + Long.MIN_VALUE + " AND token(pk) < " + Long.MAX_VALUE); - stmt.setConsistencyLevel(com.datastax.driver.core.ConsistencyLevel.ALL); - ResultSet res = s.execute(stmt); - Set seenTokens = new HashSet<>(); - Iterator rows = res.iterator(); - Set dupes = new HashSet<>(); - while (rows.hasNext()) - { - Object token = rows.next().getObject(0); - if (seenTokens.contains(token)) - dupes.add(token); - seenTokens.add(token); - } - assertEquals(message+": too few rows", 5000, seenTokens.size()); - assertTrue(message+": dupes is not empty", dupes.isEmpty()); - } - } -} diff --git a/test/distributed/org/apache/cassandra/distributed/upgrade/ReadRepairCompactStorageUpgradeTest.java b/test/distributed/org/apache/cassandra/distributed/upgrade/ReadRepairCompactStorageUpgradeTest.java deleted file mode 100644 index 5567d4010a..0000000000 --- a/test/distributed/org/apache/cassandra/distributed/upgrade/ReadRepairCompactStorageUpgradeTest.java +++ /dev/null @@ -1,57 +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.upgrade; - -import org.junit.Test; - -import org.apache.cassandra.distributed.api.ConsistencyLevel; -import org.apache.cassandra.distributed.shared.Versions; - -public class ReadRepairCompactStorageUpgradeTest extends UpgradeTestBase -{ - /** - * Tests {@code COMPACT STORAGE} behaviour with mixed replica versions. - *

- * See CASSANDRA-15363 for further details. - */ - @Test - public void mixedModeReadRepairCompactStorage() throws Throwable - { - new TestCase() - .nodes(2) - .upgrades(v22, v3X) - .setup((cluster) -> cluster.schemaChange(withKeyspace("CREATE TABLE %s.tbl" + - " (pk ascii, b boolean, v blob, PRIMARY KEY (pk))" + - " WITH COMPACT STORAGE"))) - .runAfterNodeUpgrade((cluster, node) -> { - if (node != 1) - return; - // now node1 is 3.0/3.x and node2 is 2.2 - // make sure 2.2 side does not get the mutation - cluster.get(1).executeInternal(withKeyspace("DELETE FROM %s.tbl WHERE pk = ?"), "something"); - // trigger a read repair - cluster.coordinator(2).execute(withKeyspace("SELECT * FROM %s.tbl WHERE pk = ?"), - ConsistencyLevel.ALL, - "something"); - cluster.get(2).flush(KEYSPACE); - }) - .runAfterClusterUpgrade((cluster) -> cluster.get(2).forceCompact(KEYSPACE, "tbl")) - .run(); - } -} diff --git a/test/distributed/org/apache/cassandra/distributed/upgrade/UpgradeTestBase.java b/test/distributed/org/apache/cassandra/distributed/upgrade/UpgradeTestBase.java index ce0d8e9450..5c32fcdd3b 100644 --- a/test/distributed/org/apache/cassandra/distributed/upgrade/UpgradeTestBase.java +++ b/test/distributed/org/apache/cassandra/distributed/upgrade/UpgradeTestBase.java @@ -44,14 +44,11 @@ import org.apache.cassandra.distributed.shared.DistributedTestBase; import org.apache.cassandra.distributed.shared.ThrowingRunnable; import org.apache.cassandra.distributed.shared.Versions; import org.apache.cassandra.utils.ByteBufferUtil; -import org.apache.cassandra.utils.FBUtilities; import org.apache.cassandra.utils.Pair; import static org.apache.cassandra.distributed.shared.Versions.Version; import static org.apache.cassandra.distributed.shared.Versions.find; - - public class UpgradeTestBase extends DistributedTestBase { private static final Logger logger = LoggerFactory.getLogger(UpgradeTestBase.class); @@ -85,18 +82,17 @@ public class UpgradeTestBase extends DistributedTestBase public void run(UpgradeableCluster cluster, int node) throws Throwable; } - public static final Semver v22 = new Semver("2.2.0-beta1", SemverType.LOOSE); public static final Semver v30 = new Semver("3.0.0-alpha1", SemverType.LOOSE); public static final Semver v3X = new Semver("3.11.0", SemverType.LOOSE); public static final Semver v40 = new Semver("4.0-alpha1", SemverType.LOOSE); public static final Semver v41 = new Semver("4.1-alpha1", SemverType.LOOSE); protected static final List> SUPPORTED_UPGRADE_PATHS = ImmutableList.of( - Pair.create(v22, v30), - Pair.create(v22, v3X), Pair.create(v30, v3X), Pair.create(v30, v40), + Pair.create(v30, v41), Pair.create(v3X, v40), + Pair.create(v3X, v41), Pair.create(v40, v41)); // the last is always the current @@ -267,7 +263,7 @@ public class UpgradeTestBase extends DistributedTestBase protected TestCase allUpgrades(int nodes, int... toUpgrade) { return new TestCase().nodes(nodes) - .upgradesFrom(v22) + .upgradesFrom(v30) .nodesToUpgrade(toUpgrade); }