lianetm commented on code in PR #23014:
URL: https://github.com/apache/kafka/pull/23014#discussion_r3776619137
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/FetchRequestManager.java:
##########
@@ -69,6 +74,25 @@ protected void maybeThrowAuthFailure(Node node) {
networkClientDelegate.maybeThrowAuthFailure(node);
}
+ /**
+ * {@inheritDoc}
+ *
+ * If any request is in flight, its completion will wake the application
thread regardless of the outcome, so
+ * no separate bound is needed. Otherwise, if any fetchable partition is
still not buffered, it was skipped for a
+ * transient reason, such as reconnect backoff or an unknown leader. Since
nothing else will wake the application
+ * thread in that case, its wait is bounded by {@code retryBackoffMs}.
+ */
+ @Override
+ public long maximumTimeToWait(long currentTimeMs) {
+ if (!nodesWithPendingFetchRequests.isEmpty()) {
+ return Long.MAX_VALUE;
+ }
+
+ Set<TopicPartition> buffered = fetchBuffer.bufferedPartitions();
+ boolean hasUnbufferedFetchablePartition =
!subscriptions.fetchablePartitions(tp -> !buffered.contains(tp)).isEmpty();
+ return hasUnbufferedFetchablePartition ? retryBackoffMs :
Long.MAX_VALUE;
Review Comment:
what about when simply nothing is fetchable because pending revocation or
paused? We're not bounding the wait in that case right? Should we? (if
fetchablePartitions.isEmpty bound?)
--
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]