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


##########
raft/src/test/java/org/apache/kafka/raft/KafkaRaftClientReconfigTest.java:
##########
@@ -2250,13 +2250,16 @@ void 
testFollowerSendsUpdateVoterWithKraftVersion0(Errors updateVoterError) thro
                 new LeaderAndEpoch(OptionalInt.of(voter1.id()), epoch)
             )
         );
+        // polling sends a fetch because no fetches are in flight, only the 
update voter
         context.client.poll();
+        RaftRequest.Outbound fetchRequest = context.assertSentFetchRequest();
+        context.assertFetchRequestData(fetchRequest, epoch, 0L, 0);

Review Comment:
   We need to perform this poll here in order to make sure the local replica 
does not expire its fetch timeout and transition to prospective. 
   
   This is because the poll will first send a fetch since there is not one in 
flight and its fetch timeout is not expired, and then handle the incoming 
`UpdateVoterResponse`, which will reset the fetch timeout. 
   
   Calling `context.pollUntilRequest()` below is too late because the fetch 
timeout will have expired by that point. This is because earlier, we slept for 
`context.fetchTimeoutMs - 1` BEFORE completing an `updateVoter` RPC (i.e. there 
is 1 ms left on the fetch timeout at this point).



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