kevin-wu24 commented on code in PR #20354:
URL: https://github.com/apache/kafka/pull/20354#discussion_r2278894794


##########
raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java:
##########
@@ -3356,17 +3352,13 @@ private long pollFollowerAsObserver(FollowerState 
state, long currentTimeMs) {
             } else {
                 sendResult = maybeSendAddVoterRequest(state, currentTimeMs);
             }
-            backoffMs = sendResult.timeToWaitMs();
             if (sendResult.requestSent()) {
                 state.resetUpdateVoterSetPeriod(currentTimeMs);
             }
+            return sendResult.timeToWaitMs();

Review Comment:
   The observer does not need to consider the time left on the fetch timer when 
calculating the backoff, because an observer cannot transition to 
prospective/candidate state. It must transition to follower state first.
   
   > What happens if timeToWaitMs is larger than the fetch timeout?
   If this is the case, the observer would have to wait timeToWaitMs anyways so 
its request manager doesn't have a pending request. Only then can it resume 
fetching/sending add/remove voter.



##########
raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java:
##########
@@ -3356,17 +3352,13 @@ private long pollFollowerAsObserver(FollowerState 
state, long currentTimeMs) {
             } else {
                 sendResult = maybeSendAddVoterRequest(state, currentTimeMs);
             }
-            backoffMs = sendResult.timeToWaitMs();
             if (sendResult.requestSent()) {
                 state.resetUpdateVoterSetPeriod(currentTimeMs);
             }
+            return sendResult.timeToWaitMs();

Review Comment:
   The observer does not need to consider the time left on the fetch timer when 
calculating the backoff, because an observer cannot transition to 
prospective/candidate state. It must transition to follower state first.
   
   > What happens if timeToWaitMs is larger than the fetch timeout?
   
   If this is the case, the observer would have to wait timeToWaitMs anyways so 
its request manager doesn't have a pending request. Only then can it resume 
fetching/sending add/remove voter.



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