cmccabe commented on code in PR #16626:
URL: https://github.com/apache/kafka/pull/16626#discussion_r1684606840


##########
raft/src/main/java/org/apache/kafka/raft/LeaderState.java:
##########
@@ -273,10 +292,29 @@ public void 
appendLeaderChangeMessageAndBootstrapRecords(long currentTimeMs) {
         accumulator.forceDrain();
     }
 
+    public long appendVotersRecord(VoterSet voters, long currentTimeMs) {
+        return accumulator.appendVotersRecord(
+            
voters.toVotersRecord(ControlRecordUtils.KRAFT_VOTERS_CURRENT_VERSION),
+            currentTimeMs
+        );
+    }
+
     public boolean isResignRequested() {
         return resignRequested;
     }
 
+    public boolean isReplicaCaughtUp(ReplicaKey replicaKey, long 
currentTimeMs) {
+        // In summary, let's consider a replica caughed up for add voter, if 
they
+        // have fetched within the last hour
+        return Optional.ofNullable(observerStates.get(replicaKey))
+            .map(state ->
+                state.lastCaughtUpTimestamp > 0 &&
+                state.lastFetchTimestamp > 0 &&
+                state.lastFetchTimestamp > currentTimeMs - 3600000

Review Comment:
   can we have a constant for this?



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