lianetm commented on code in PR #23124:
URL: https://github.com/apache/kafka/pull/23124#discussion_r3754613433
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/FetchRequestManager.java:
##########
@@ -146,9 +146,13 @@ private PollResult pollInternal(FetchRequestPreparer
fetchRequestPreparer,
Map<Node, FetchSessionHandler.FetchRequestData> fetchRequests =
fetchRequestPreparer.prepare();
if (fetchRequests.isEmpty()) {
- // If there's nothing to fetch, wake up the FetchBuffer so it
doesn't needlessly wait for a wakeup
- // that won't come until the data in the fetch buffer is
consumed.
- fetchBuffer.wakeup();
+ // If no fetch requests were generated, wake up the
FetchBuffer so the application thread doesn't
+ // needlessly wait for a wakeup that won't come: it can still
collect data that a node may have
+ // buffered, and submit a new poll event to generate the next
request.
+ // Only do so, though, when no response is still expected and
a fetch request could actually be generated.
+ if (nodesWithPendingFetchRequests.isEmpty() &&
hasFetchablePartitions())
Review Comment:
this condition is the fix for the main issue
--
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]