bdeggleston commented on code in PR #4708: URL: https://github.com/apache/cassandra/pull/4708#discussion_r3431687478
########## src/java/org/apache/cassandra/locator/WriteResponseTracker.java: ########## @@ -0,0 +1,237 @@ +/* + * 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.locator; + +import java.util.function.Predicate; + +import org.apache.cassandra.exceptions.RequestFailureReason; + +/** + * Response tracker for writes with pending replicas using the double count model. + * <p> + * Two requirements must be satisfied for success: + * <ol> + * <li>Committed replicas must satisfy base CL: {@code committedSuccesses >= baseBlockFor}</li> + * <li>Total replicas (committed + pending) must satisfy: {@code totalSuccesses >= totalBlockFor}</li> + * </ol> + * <p> + * This ensures both consistency (committed replicas have the data) and bootstrap safety + * (pending replicas also receive the write). + * <p> + * Implemented by composing two {@link SimpleResponseTracker}s: + * <ul> + * <li>committedTracker: tracks responses from committed replicas only</li> + * <li>totalTracker: tracks responses from all replicas (committed + pending)</li> + * </ul> + * <p> + * Thread-safe through delegation to thread-safe SimpleResponseTrackers. + */ +public class WriteResponseTracker implements ResponseTracker +{ + private final SimpleResponseTracker natural; + private final SimpleResponseTracker total; Review Comment: Pre ResponseTracker writes use `naturalQuorum+pending` for writes. This is equivalent to that for single pending nodes, but prevents correctness/liveness issues in some of the more extreme scenarios the property based tests cooked up. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

