From 9bd69f2feccce978f60c7c38f00d7febde2940ef Mon Sep 17 00:00:00 2001 From: Blake Eggleston Date: Wed, 17 Jun 2026 15:14:49 -0700 Subject: [PATCH] feedback --- .../locator/AbstractReplicationStrategy.java | 10 ++++---- .../cassandra/service/paxos/PaxosCommit.java | 24 +++++++++---------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java b/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java index e4ae4cdd94..991c4f409d 100644 --- a/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java +++ b/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java @@ -463,10 +463,10 @@ public abstract class AbstractReplicationStrategy } protected CoordinationPlan.ForWrite planForWriteInternal(ClusterMetadata metadata, - Keyspace keyspace, - ConsistencyLevel consistencyLevel, - Function liveAndDown, - ReplicaPlans.Selector selector) + Keyspace keyspace, + ConsistencyLevel consistencyLevel, + Function liveAndDown, + ReplicaPlans.Selector selector) { ReplicaPlan.ForWrite plan = ReplicaPlans.forWrite(metadata, keyspace, consistencyLevel, liveAndDown, selector); ResponseTracker tracker = createTrackerForWrite(consistencyLevel, plan, plan.pending, metadata); @@ -651,7 +651,7 @@ public abstract class AbstractReplicationStrategy /** * Create ResponseTracker for read operation. */ - public , P extends ReplicaPlan.ForRead> ResponseTracker createTrackerForRead(P plan) + private , P extends ReplicaPlan.ForRead> ResponseTracker createTrackerForRead(P plan) { int blockFor = plan.readQuorum(); diff --git a/src/java/org/apache/cassandra/service/paxos/PaxosCommit.java b/src/java/org/apache/cassandra/service/paxos/PaxosCommit.java index 88a2f14b16..ede37fced9 100644 --- a/src/java/org/apache/cassandra/service/paxos/PaxosCommit.java +++ b/src/java/org/apache/cassandra/service/paxos/PaxosCommit.java @@ -461,19 +461,6 @@ public class PaxosCommit> ex boolean localExecutedSynchronously = false; InetAddressAndPort localEndpoint = FBUtilities.getBroadcastAddressAndPort(); - // Set up additional commit work from the replication strategy (e.g., satellite writes for SRS). - // This needs to happen before executeOnSelf() can trigger onPaxosDecision(), so that - // additionalCommitFuture is set before it's read. The base strategy returns an - // already-completed future, so this is a no-op for non-SRS keyspaces. - // For SRS, satellite messages are sent here (in parallel with local execution below). - // MutationTrackingService.retryFailedWrite for down satellite endpoints schedules async retries, - // which will find the mutation in the journal after executeOnSelf() completes below. - if (isTrackedKeyspace) - { - AbstractReplicationStrategy strategy = Keyspace.open(commit.metadata().keyspace).getReplicationStrategy(); - setAugmentedCommitFuture(strategy.sendPaxosCommitMutations(commit, isUrgent)); - } - if (isTrackedKeyspace) { // For tracked keyspaces, we MUST execute locally synchronously, regardless of USE_SELF_EXECUTION setting. @@ -504,11 +491,22 @@ public class PaxosCommit> ex } } } + if (localIsReplica) { executeOnSelf(); localExecutedSynchronously = true; } + + // Set up additional commit work from the replication strategy (e.g., satellite writes for SRS). + // This needs to happen before executeOnSelf() can trigger onPaxosDecision(), so that + // additionalCommitFuture is set before it's read. The base strategy returns an + // already-completed future, so this is a no-op for non-SRS keyspaces. + // For SRS, satellite messages are sent here (in parallel with local execution below). + // MutationTrackingService.retryFailedWrite for down satellite endpoints schedules async retries, + // which will find the mutation in the journal after executeOnSelf() completes below. + AbstractReplicationStrategy strategy = Keyspace.open(commit.metadata().keyspace).getReplicationStrategy(); + setAugmentedCommitFuture(strategy.sendPaxosCommitMutations(commit, isUrgent)); } // Now send to remote replicas in the electorate (and record local execution for non-tracked keyspaces)