ifesdjeen commented on code in PR #4015:
URL: https://github.com/apache/cassandra/pull/4015#discussion_r2018032884


##########
test/distributed/org/apache/cassandra/distributed/upgrade/MixedModePaxosTest.java:
##########
@@ -0,0 +1,229 @@
+/*
+ * 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.nio.ByteBuffer;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.cassandra.db.SimpleBuilders;
+import org.apache.cassandra.db.marshal.Int32Type;
+import org.apache.cassandra.db.partitions.PartitionUpdate;
+import org.apache.cassandra.db.rows.Row;
+import org.apache.cassandra.dht.Murmur3Partitioner;
+import org.apache.cassandra.distributed.api.ConsistencyLevel;
+import org.apache.cassandra.distributed.api.Feature;
+import org.apache.cassandra.distributed.api.ICoordinator;
+import org.apache.cassandra.net.MessagingService;
+import org.apache.cassandra.schema.TableId;
+import org.apache.cassandra.schema.TableMetadata;
+import org.apache.cassandra.service.paxos.Ballot;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
+import static java.lang.String.format;
+
+public class MixedModePaxosTest extends UpgradeTestBase
+{
+    private static final Logger logger = 
LoggerFactory.getLogger(MixedModePaxosTest.class);
+
+    /**
+     * Tests the mixed mode loop bug in CASSANDRA-20493
+     *
+     * Paxos uses a 'zero' ballot in place of null when it doesn't find a 
ballot in system.paxos. CEP-14 changed the lsb
+     * of the zero ballot uuid from -9187201950435737472 to 0. It also removed 
the check added in CASSANDRA-12043, since

Review Comment:
   It could be useful to use hexadecimal `0x8080808080808080` in place of 
integer constant here. 



##########
src/java/org/apache/cassandra/service/paxos/Ballot.java:
##########
@@ -38,6 +38,7 @@
 public class Ballot extends TimeUUID
 {
     public static final long serialVersionUID = 1L;
+    private static final long LEGACY_MIN_CLOCK_SEQ_AND_NODE = 
0x8080808080808080L;

Review Comment:
   Do you think it'd be unreasonable to make `MIN_CLOCK_SEQ_AND_NODE` public on 
`TimeUUID`? If so, maybe adding a small comment about the source of this 
constant could be useful for context.



##########
test/distributed/org/apache/cassandra/distributed/upgrade/MixedModePaxosTest.java:
##########
@@ -0,0 +1,229 @@
+/*
+ * 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.nio.ByteBuffer;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.cassandra.db.SimpleBuilders;
+import org.apache.cassandra.db.marshal.Int32Type;
+import org.apache.cassandra.db.partitions.PartitionUpdate;
+import org.apache.cassandra.db.rows.Row;
+import org.apache.cassandra.dht.Murmur3Partitioner;
+import org.apache.cassandra.distributed.api.ConsistencyLevel;
+import org.apache.cassandra.distributed.api.Feature;
+import org.apache.cassandra.distributed.api.ICoordinator;
+import org.apache.cassandra.net.MessagingService;
+import org.apache.cassandra.schema.TableId;
+import org.apache.cassandra.schema.TableMetadata;
+import org.apache.cassandra.service.paxos.Ballot;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
+import static java.lang.String.format;
+
+public class MixedModePaxosTest extends UpgradeTestBase
+{
+    private static final Logger logger = 
LoggerFactory.getLogger(MixedModePaxosTest.class);
+
+    /**
+     * Tests the mixed mode loop bug in CASSANDRA-20493
+     *
+     * Paxos uses a 'zero' ballot in place of null when it doesn't find a 
ballot in system.paxos. CEP-14 changed the lsb
+     * of the zero ballot uuid from -9187201950435737472 to 0. It also removed 
the check added in CASSANDRA-12043, since
+     * the way it read and filtered ttld paxos data had been improved.
+     *
+     * In mixed mode with a 4.0 or lower replica and a 4.1 and higher paxos 
coordinator, and in the absence of existing
+     * paxos metadata for the key being queried, the prepare phase will 
interpret the mismatched ‘zero’ ballots as the
+     * 4.0 and lower nodes having missed the most recent commit and will 
attempt to update them using the 4.1 zero ballot
+     * and empty partition update.
+     *
+     * In cases where this is the first paxos operation on a key, or the 
previously ttl'd paxos data on disk had been purged,
+     * this would just add a retry step as it updated the 4.0 and lower hosts 
with it's zero ballot.

Review Comment:
   nit: its? 



-- 
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.

To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org

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


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

Reply via email to