jsancio commented on code in PR #19800:
URL: https://github.com/apache/kafka/pull/19800#discussion_r2150833728


##########
raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java:
##########
@@ -386,6 +385,11 @@ private void onUpdateLeaderHighWatermark(
             // records still held in memory directly to the listener
             appendPurgatory.maybeComplete(highWatermark.offset(), 
currentTimeMs);
 
+            // After updating the high-watermark, complete all of the deferred
+            // fetch requests. This is always correct because all fetch request
+            // deferred have a HWM less or equal to the previous leader's HWM.
+            fetchPurgatory.completeAll(currentTimeMs);

Review Comment:
   Correct. Handling of RPCs is single threaded and handle the the raft client 
driver thread.
   
   This is a bit harder to show but raft driver is also the only thread that 
can increase the HWM, this is because the HWM can only increase because of a 
FETCH request (when there are more than one voter) or by appending a batch when 
the voters set only has one voter. Both of these operation are done only by the 
raft driver thread.



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to