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


##########
raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java:
##########
@@ -1990,7 +1995,7 @@ private long pollLeader(long currentTimeMs) {
         LeaderState<T> state = quorum.leaderStateOrThrow();
         maybeFireLeaderChange(state);
 
-        if (shutdown.get() != null || state.isResignRequested()) {
+        if (shutdown.get() != null || state.isResignRequested() || 
state.hasMajorityFollowerFetchExpired(currentTimeMs)) {

Review Comment:
   In line 
[2014](https://github.com/apache/kafka/pull/14428/files#diff-1da15c51e641ea46ea5c86201ab8f21cfee9e7c575102a39c7bae0d5ffd7de39R2014)
 KRaft calculates the next time it should poll the leader.
   ```java
           return Math.min(timeUntilFlush, timeUntilSend);
   ```
   
   If you extend this to something like below, it should wake up the leader 
when the timer has expired.
   ```java
           return Math.min(timeUntilFlush, timeUntilSend, 
state.checkQuorumExpiry());
   ```



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