You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/02/03 07:04:55 UTC

[GitHub] [kafka] guozhangwang commented on a change in pull request #10022: KAFKA-12268; Return from KafkaConsumer.poll only when records available or timeout

guozhangwang commented on a change in pull request #10022:
URL: https://github.com/apache/kafka/pull/10022#discussion_r569174212



##########
File path: clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java
##########
@@ -1236,7 +1236,7 @@ public void assign(Collection<TopicPartition> partitions) {
                 }
 
                 final FetchedRecords<K, V> records = pollForFetches(timer);
-                if (!records.isEmpty()) {
+                if (!records.records().isEmpty()) {

Review comment:
       I had thought about that with @vvcephei on the original PR that changes this behavior:
   
   https://github.com/apache/kafka/pull/9836#issuecomment-765592268
   
   And we decided this is not going to impact users much in practice and hence still went ahead with it since by the end of the day, we would still condition on `ConsumerRecords#isEmpty` or the for loop to process records if there are any; but I admit that I did not catch the javadoc statement back then.
   
   At the moment, I think we could change the javadoc along with the PR if so far we've only seen our tests being broken because it relies on this guarantee; if you have any common use cases that may be impacted by this behavior change, I'd love to hear and revisit.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org