ahuang98 commented on code in PR #20318:
URL: https://github.com/apache/kafka/pull/20318#discussion_r2449069604


##########
raft/src/main/java/org/apache/kafka/raft/LeaderState.java:
##########
@@ -188,6 +188,19 @@ public void resetBeginQuorumEpochTimer(long currentTimeMs) 
{
         beginQuorumEpochTimer.reset(beginQuorumEpochTimeoutMs);
     }
 
+    // Leader don't need to send begin quorum requests to replicas which have 
fetched recently.
+    public Set<ReplicaKey> needToSendBeginQuorumRequests(long currentTimeMs) {
+        Set<ReplicaKey> replicaKeys = new HashSet<>();
+        beginQuorumEpochTimer.update(currentTimeMs);
+        for (ReplicaState state : voterStates.values()) {
+            if (currentTimeMs - state.lastFetchTimestamp >= 
beginQuorumEpochTimeoutMs
+                || !state.hasAcknowledgedLeader) {

Review Comment:
   that's fair, even if `state.lastFetchTimestamp` is negative one the math 
will still work out. I can see how having this additional check is more 
deliberate/explicit but not actually necessary



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

Reply via email to