lianetm commented on code in PR #16885:
URL: https://github.com/apache/kafka/pull/16885#discussion_r1757086795
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/OffsetsRequestManager.java:
##########
@@ -372,15 +372,15 @@ private CompletableFuture<Void>
initWithCommittedOffsetsIfNeeded(long deadlineMs
final long fetchCommittedDeadlineMs = Math.max(deadlineMs,
time.milliseconds() + defaultApiTimeoutMs);
CompletableFuture<Map<TopicPartition, OffsetAndMetadata>>
fetchOffsets =
commitRequestManager.fetchOffsets(initializingPartitions,
fetchCommittedDeadlineMs);
- fetchOffsets.whenComplete((offsets, error) -> {
- pendingOffsetFetchEvent = null;
- // Update positions with the retrieved offsets and request
reset for partitions that may still
- // require a position after it
- refreshOffsetsAndResetPositionsStillMissing(offsets, error,
result);
- });
- pendingOffsetFetchEvent = new
PendingFetchCommittedRequest(initializingPartitions, fetchOffsets);
+ CompletableFuture<Map<TopicPartition, OffsetAndMetadata>>
fetchOffsetsAndRefresh =
Review Comment:
I introduced this var here just to make sure that we when reusing a fetch,
we only complete the whole operation and move onto reset positions once we have
applied the retrieved offsets. Without this var, I was adding 2 `whenComplete`
to the same future (ln 376 and ln 384), and those would execute in reverse
order of addition.
--
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]