You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ma...@apache.org on 2022/05/04 06:19:37 UTC
[cassandra] branch cassandra-4.1 updated: Use TimeUUID serializer for BATCH_REMOVE_REQ
This is an automated email from the ASF dual-hosted git repository.
marcuse pushed a commit to branch cassandra-4.1
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/cassandra-4.1 by this push:
new 3b648ca09e Use TimeUUID serializer for BATCH_REMOVE_REQ
3b648ca09e is described below
commit 3b648ca09ecfc100d5ad2e3b462d4949dbc03498
Author: Marcus Eriksson <ma...@apache.org>
AuthorDate: Thu Apr 28 15:50:11 2022 +0200
Use TimeUUID serializer for BATCH_REMOVE_REQ
Patch by marcuse; reviewed by Benedict Elliott Smith for CASSANDRA-17451
---
src/java/org/apache/cassandra/net/Verb.java | 3 +-
.../distributed/upgrade/BatchUpgradeTest.java | 56 ++++++++++++++++++++++
2 files changed, 58 insertions(+), 1 deletion(-)
diff --git a/src/java/org/apache/cassandra/net/Verb.java b/src/java/org/apache/cassandra/net/Verb.java
index 0818d4194d..597da3fb9a 100644
--- a/src/java/org/apache/cassandra/net/Verb.java
+++ b/src/java/org/apache/cassandra/net/Verb.java
@@ -96,6 +96,7 @@ import org.apache.cassandra.service.paxos.PrepareResponse;
import org.apache.cassandra.service.paxos.v1.PrepareVerbHandler;
import org.apache.cassandra.service.paxos.v1.ProposeVerbHandler;
import org.apache.cassandra.streaming.ReplicationDoneVerbHandler;
+import org.apache.cassandra.utils.TimeUUID;
import org.apache.cassandra.utils.UUIDSerializer;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
@@ -118,7 +119,7 @@ public enum Verb
BATCH_STORE_RSP (65, P1, writeTimeout, REQUEST_RESPONSE, () -> NoPayload.serializer, () -> ResponseVerbHandler.instance ),
BATCH_STORE_REQ (5, P3, writeTimeout, MUTATION, () -> Batch.serializer, () -> BatchStoreVerbHandler.instance, BATCH_STORE_RSP ),
BATCH_REMOVE_RSP (66, P1, writeTimeout, REQUEST_RESPONSE, () -> NoPayload.serializer, () -> ResponseVerbHandler.instance ),
- BATCH_REMOVE_REQ (6, P3, writeTimeout, MUTATION, () -> UUIDSerializer.serializer, () -> BatchRemoveVerbHandler.instance, BATCH_REMOVE_RSP ),
+ BATCH_REMOVE_REQ (6, P3, writeTimeout, MUTATION, () -> TimeUUID.Serializer.instance, () -> BatchRemoveVerbHandler.instance, BATCH_REMOVE_RSP ),
PAXOS_PREPARE_RSP (93, P2, writeTimeout, REQUEST_RESPONSE, () -> PrepareResponse.serializer, () -> ResponseVerbHandler.instance ),
PAXOS_PREPARE_REQ (33, P2, writeTimeout, MUTATION, () -> Commit.serializer, () -> PrepareVerbHandler.instance, PAXOS_PREPARE_RSP ),
diff --git a/test/distributed/org/apache/cassandra/distributed/upgrade/BatchUpgradeTest.java b/test/distributed/org/apache/cassandra/distributed/upgrade/BatchUpgradeTest.java
new file mode 100644
index 0000000000..fb442331bf
--- /dev/null
+++ b/test/distributed/org/apache/cassandra/distributed/upgrade/BatchUpgradeTest.java
@@ -0,0 +1,56 @@
+/*
+ * 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 static org.junit.Assert.assertEquals;
+
+public class BatchUpgradeTest extends UpgradeTestBase
+{
+ @Test
+ public void batchTest() throws Throwable
+ {
+ new TestCase()
+ .nodes(2)
+
+ .nodesToUpgrade(2)
+ .upgradesFrom(v40).setup((cluster) -> {
+ cluster.schemaChange("CREATE TABLE "+KEYSPACE+".users (" +
+ "userid uuid PRIMARY KEY," +
+ "firstname ascii," +
+ "lastname ascii," +
+ "age int) WITH COMPACT STORAGE");
+ }).runAfterNodeUpgrade((cluster, node) -> {
+ cluster.coordinator(2).execute("BEGIN BATCH\n" +
+ " UPDATE "+KEYSPACE+".users SET age = 37 WHERE userid = f47ac10b-58cc-4372-a567-0e02b2c3d479\n" +
+ " DELETE firstname, lastname FROM "+KEYSPACE+".users WHERE userid = 550e8400-e29b-41d4-a716-446655440000\n" +
+ "APPLY BATCH", ConsistencyLevel.ALL);
+ }).runAfterClusterUpgrade((cluster) -> {
+ assertEquals(0, cluster.get(1).executeInternal("select * from system.batches").length);
+ assertEquals(0, cluster.get(2).executeInternal("select * from system.batches").length);
+ assertEquals(0, cluster.get(1).logs().grep("ClassCastException").getResult().size());
+ assertEquals(0, cluster.get(2).logs().grep("ClassCastException").getResult().size());
+ })
+ .run();
+
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org