guozhangwang commented on pull request #9836:
URL: https://github.com/apache/kafka/pull/9836#issuecomment-765552356


   > I ran the PlaintextConsumerTest a bunch more times, and also searched 
through the trunk build logs. I think this PR did make the test more flaky, and 
I suspect the reason is that the consumer long-poll will now return "early" if 
we get a metadata-only fetch response. I've adjusted the test to account for 
this, and we'll see how the build does now.
   
   Got it. How about this:
   
   In `KafkaConsumer.java` line 
   
   ```
   if (!records.isEmpty()) {
                       // before returning the fetched records, we can send off 
the next round of fetches
                       // and avoid block waiting for their responses to enable 
pipelining while the user
                       // is handling the fetched records.
                       //
                       // NOTE: since the consumed position has already been 
updated, we must not allow
                       // wakeups or any other errors to be triggered prior to 
returning the fetched records.
                       if (fetcher.sendFetches() > 0 || 
client.hasPendingRequests()) {
                           client.transmitSends();
                       }
   
                       return this.interceptors.onConsume(new 
ConsumerRecords<>(records));
                   }
   ```
   
   We change the condition to `records.records().isEmpty`?


----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to