aweisberg commented on code in PR #4015: URL: https://github.com/apache/cassandra/pull/4015#discussion_r2017537659
########## test/distributed/org/apache/cassandra/distributed/upgrade/MixedModePaxosTest.java: ########## @@ -0,0 +1,226 @@ +/* + * 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. However, this means that 4.1 and higher paxos + * coordinators, the prepare phase will always interpret the most recent commits from 4.0 and lower nodes as being + * less than its own and will update them with its slightly higher 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. On nodes where there was + * ttl'd paxos data though, the ttl'd data on disk would shadow this update and the conflicting 'zero' value would Review Comment: Maybe just extend this comment that the TTLed data would have a timestamp > 0 which shadows none even if the TTLed data doesn't end up returned in a read. It should be obvious, but you have to make the connection between the timestamp for the paxos system table row being the timestamp of the a ballot which those less familiar with the table won't think of immediately. -- 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