You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "krummas (via GitHub)" <gi...@apache.org> on 2026/10/23 12:21:03 UTC

[PR] CASSANDRA-21330; Avoid unnecessarily failing reads/writes when epoch is bumped during the operation [cassandra]

krummas opened a new pull request, #5297:
URL: https://github.com/apache/cassandra/pull/5297

   Thanks for sending a pull request! Here are some tips if you're new here:
    
    * Ensure you have added or run the [appropriate tests](https://cassandra.apache.org/_/development/testing.html) for your PR.
    * Be sure to keep the PR description updated to reflect all changes.
    * Write your PR title to summarize what this PR proposes.
    * If possible, provide a concise example to reproduce the issue for a faster review.
    * Read our [contributor guidelines](https://cassandra.apache.org/_/development/index.html)
    * If you're making a documentation change, see our [guide to documentation contribution](https://cassandra.apache.org/_/development/documentation.html)
    
   Commit messages should follow the following format:
   
   ```
   <One sentence description, usually Jira title or CHANGES.txt summary>
   
   <Optional lengthier description (context on patch)>
   
   patch by <Authors>; reviewed by <Reviewers> for CASSANDRA-#####
   
   Co-authored-by: Name1 <email1>
   Co-authored-by: Name2 <email2>
   
   ```
   
   The [Cassandra Jira](https://issues.apache.org/jira/projects/CASSANDRA/issues/)
   
   


-- 
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-unsubscribe@cassandra.apache.org

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


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


Re: [PR] CASSANDRA-21330; Avoid unnecessarily failing reads/writes when epoch is bumped during the operation [cassandra]

Posted by "beobal (via GitHub)" <gi...@apache.org>.
beobal commented on code in PR #5297:
URL: https://github.com/apache/cassandra/pull/5297#discussion_r4376920059


##########
src/java/org/apache/cassandra/service/reads/repair/BlockingPartitionRepair.java:
##########
@@ -68,14 +69,16 @@ public class BlockingPartitionRepair
     private final CountDownLatch latch;
     private final int blockFor;
     private volatile long mutationsSentTime;
+    private final EndpointsForToken uptodateEndpoints;
 
     @VisibleForTesting
-    public BlockingPartitionRepair(ReadCoordinator coordinator, DecoratedKey key, Map<Replica, Mutation> repairs, ReplicaPlan.ForWrite repairPlan)
+    public BlockingPartitionRepair(ReadCoordinator coordinator, DecoratedKey key, Map<Replica, Mutation> repairs, EndpointsForToken uptodateEndpoints, ReplicaPlan.ForWrite repairPlan)

Review Comment:
   I don't think we need to explicitly pass the up to date endpoints here, or in any of the other impls.
   `repairPlan.contacts()` contains all the replicas whether they required mutations or not and `repairs.keySet()` is the set which received repairs. So we can calculate the up to date endpoints from that. Tried that out [here](https://github.com/beobal/cassandra/commits/samt/CASSANDRA-21330/) and everything seems to be fine.



##########
src/java/org/apache/cassandra/service/reads/repair/BlockingPartitionRepair.java:
##########
@@ -258,7 +269,8 @@ public void maybeSendAdditionalWrites(long timeout, TimeUnit timeoutUnit)
         }
     }
 
-    Keyspace getKeyspace()
+    @Override
+    public Keyspace getKeyspace()

Review Comment:
   This doesn't need to be made public



##########
src/java/org/apache/cassandra/service/reads/repair/BlockingPartitionRepair.java:
##########
@@ -270,6 +256,20 @@ public void maybeSendAdditionalWrites(long timeout, TimeUnit timeoutUnit)
     }
 
     @Override
+    public void checkPlacements(ClusterMetadata metadata)
+    {
+        if (repairPlan.epoch().equals(metadata.epoch))
+            return;
+        // just copy the repair plan
+        ReplicaPlan.ForWrite r = repairPlan.withContacts(repairPlan.contacts());

Review Comment:
   I appreciate the comment helps, but I feel it's still a bit non-obvious what we are doing here and why. Maybe it would be better to add a new method to ReplicaPlan like:
   ```
   public ForWrite copy() 
   { 
       return copy(consistencyLevel, contacts())); 
   }
   ``` 
   A secondary consideration is whether `copy()` is a good name for such a method, or if it should be more explicit about its intended usage.



-- 
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-unsubscribe@cassandra.apache.org

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


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