maedhroz commented on code in PR #4740:
URL: https://github.com/apache/cassandra/pull/4740#discussion_r3139094599


##########
src/java/org/apache/cassandra/service/reads/repair/AbstractReadRepair.java:
##########
@@ -119,10 +120,27 @@ void sendReadCommand(Replica to, ReadCallback<E, P> 
readCallback, boolean specul
 
     abstract Meter getRepairMeter();
 
+    /**
+     * Mark the repair meter at most once per read command. Single-partition 
reads mark
+     * via {@code startRepair()} on digest mismatch. Range reads never call 
{@code startRepair()}
+     * — they go through {@code DataResolver.resolveWithReadRepair()} which 
calls
+     * {@code repairPartition()} directly for each inconsistent partition. 
Without this
+     * guard, range reads would either miss the metric entirely (if only 
marked in
+     * {@code startRepair()}) or over-count (if marked per partition in {@code 
repairPartition()}).
+     */
+    protected void markRepairMeter()
+    {
+        if (!repairMeterMarked)

Review Comment:
   Should we mark `AbstractReadRepair` with `@NotThreadSafe` in that case? Also 
noting for the record that we're also making `digestRepair` non-volatile, which 
is fine if we're indeed  accessing from the same thread I guess.



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

Reply via email to