lianetm commented on code in PR #23327:
URL: https://github.com/apache/kafka/pull/23327#discussion_r3917160573


##########
clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java:
##########
@@ -2815,7 +2815,14 @@ public void 
testReturnRecordsDuringRebalance(GroupProtocol groupProtocol) throws
         fetches1.put(t2p0, new FetchInfo(0, 10));
         client.respondFrom(fetchResponse(fetches1), node);
 
-        ConsumerRecords<String, String> records = consumer.poll(Duration.ZERO);
+        // A background heartbeat can complete the fetch concurrently, so a 
single poll may return

Review Comment:
   nit just to be accurate on the gap, the problem is not really that the HB 
can complete the fetch, it is that it does it in 2 steps and the app thread and 
interleave. 
   
   So maybe something along the lines of: `"A background heartbeat poll can 
retrieve a completed fetch, and then trigger its completion logic in a separate 
step (to put the data in the buffer). If the app thread poll runs in between, 
it will find no completed request or buffered data, so it may return empty 
records on a first poll attempt"`



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