You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2021/01/26 00:17:30 UTC

[GitHub] [cassandra] yifan-c commented on a change in pull request #873: CASSANDRA-16244 Create a jvm upgrade dtest for mixed versions repairs

yifan-c commented on a change in pull request #873:
URL: https://github.com/apache/cassandra/pull/873#discussion_r564126802



##########
File path: test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeRepairTest.java
##########
@@ -0,0 +1,113 @@
+/*
+ * 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.UUID;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.apache.cassandra.distributed.UpgradeableCluster;
+import org.apache.cassandra.distributed.api.IUpgradeableInstance;
+
+import static org.apache.cassandra.distributed.api.Feature.GOSSIP;
+import static org.apache.cassandra.distributed.api.Feature.NETWORK;
+import static org.apache.cassandra.distributed.shared.AssertUtils.assertEquals;
+import static org.apache.cassandra.distributed.shared.AssertUtils.assertNotEquals;
+import static org.apache.cassandra.distributed.shared.AssertUtils.assertRows;
+import static org.apache.cassandra.distributed.shared.AssertUtils.row;
+import static org.apache.cassandra.distributed.shared.ClusterUtils.awaitRingJoin;
+import static org.apache.cassandra.distributed.shared.Versions.Major;
+
+/**
+ * Tests that repair only works on mixed mode clusters if there isn't a major upgrade. Otherwise, repair attempts will
+ * be rejected with an informative message.
+ */
+public class MixedModeRepairTest extends UpgradeTestBase
+{
+    public static final String CREATE_TABLE = withKeyspace("CREATE TABLE %s.t (k uuid, c int, v int, PRIMARY KEY (k, c))");
+    public static final String INSERT = withKeyspace("INSERT INTO %s.t (k, c, v) VALUES (?, ?, ?)");
+    public static final String SELECT = withKeyspace("SELECT * FROM %s.t WHERE k=?");
+
+    @Test
+    public void testMixedModeRepair() throws Throwable
+    {
+        new UpgradeTestBase.TestCase()
+        .nodes(2)
+        .nodesToUpgrade(2)
+        .upgrade(Major.v30, Major.v4)
+        .upgrade(Major.v3X, Major.v4)
+        .withConfig(config -> config.with(NETWORK, GOSSIP))
+        .setup(cluster -> cluster.schemaChange(withKeyspace(CREATE_TABLE)))

Review comment:
       Not need to wrap the `CREATE_TABLE` with `withKeyspace()` again. 

##########
File path: test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeRepairTest.java
##########
@@ -0,0 +1,113 @@
+/*
+ * 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.UUID;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.apache.cassandra.distributed.UpgradeableCluster;
+import org.apache.cassandra.distributed.api.IUpgradeableInstance;
+
+import static org.apache.cassandra.distributed.api.Feature.GOSSIP;
+import static org.apache.cassandra.distributed.api.Feature.NETWORK;
+import static org.apache.cassandra.distributed.shared.AssertUtils.assertEquals;
+import static org.apache.cassandra.distributed.shared.AssertUtils.assertNotEquals;
+import static org.apache.cassandra.distributed.shared.AssertUtils.assertRows;
+import static org.apache.cassandra.distributed.shared.AssertUtils.row;
+import static org.apache.cassandra.distributed.shared.ClusterUtils.awaitRingJoin;
+import static org.apache.cassandra.distributed.shared.Versions.Major;
+
+/**
+ * Tests that repair only works on mixed mode clusters if there isn't a major upgrade. Otherwise, repair attempts will
+ * be rejected with an informative message.
+ */
+public class MixedModeRepairTest extends UpgradeTestBase
+{
+    public static final String CREATE_TABLE = withKeyspace("CREATE TABLE %s.t (k uuid, c int, v int, PRIMARY KEY (k, c))");
+    public static final String INSERT = withKeyspace("INSERT INTO %s.t (k, c, v) VALUES (?, ?, ?)");
+    public static final String SELECT = withKeyspace("SELECT * FROM %s.t WHERE k=?");
+
+    @Test
+    public void testMixedModeRepair() throws Throwable
+    {
+        new UpgradeTestBase.TestCase()
+        .nodes(2)
+        .nodesToUpgrade(2)
+        .upgrade(Major.v30, Major.v4)
+        .upgrade(Major.v3X, Major.v4)
+        .withConfig(config -> config.with(NETWORK, GOSSIP))
+        .setup(cluster -> cluster.schemaChange(withKeyspace(CREATE_TABLE)))

Review comment:
       ```suggestion
           .setup(cluster -> {
               cluster.schemaChange(CREATE_TABLE);
               cluster.setUncaughtExceptionsFilter(throwable -> throwable instanceof RejectedExecutionException);
           })
   ```
   
   The test fails with `RejectedExecutionException` when shutting down occasionally. We can set the uncaught exception filter to ignore the error. 
   
   The full trace:
   
   ```
   INFO  [ACCEPT-/127.0.0.1] node1 2021-01-25 15:30:44,734 MessagingService.java:1129 - MessagingService has terminated the accept() thread
   
   org.apache.cassandra.distributed.shared.ShutdownException: Uncaught exceptions were thrown during test
   
     at org.apache.cassandra.distributed.impl.AbstractCluster.checkAndResetUncaughtExceptions(AbstractCluster.java:862)
     at org.apache.cassandra.distributed.impl.AbstractCluster.close(AbstractCluster.java:848)
     at org.apache.cassandra.distributed.upgrade.UpgradeTestBase$TestCase.run(UpgradeTestBase.java:185)
     at org.apache.cassandra.distributed.upgrade.MixedModeRepairTest.testMixedModeRepair(MixedModeRepairTest.java:106)
     ...
     Suppressed: java.util.concurrent.RejectedExecutionException: ThreadPoolExecutor has shut down
       at org.apache.cassandra.concurrent.DebuggableThreadPoolExecutor$1.rejectedExecution(DebuggableThreadPoolExecutor.java:61)
       ...
       at org.apache.cassandra.concurrent.DebuggableThreadPoolExecutor.execute(DebuggableThreadPoolExecutor.java:151)
       at org.apache.cassandra.net.MessagingService.receive(MessagingService.java:873)
       at org.apache.cassandra.net.IncomingTcpConnection.receiveMessage(IncomingTcpConnection.java:212)
       at org.apache.cassandra.net.IncomingTcpConnection.receiveMessages(IncomingTcpConnection.java:181)
       at org.apache.cassandra.net.IncomingTcpConnection.run(IncomingTcpConnection.java:92)
   ```
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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