sunm2n commented on code in PR #24181:
URL: https://github.com/apache/kafka/pull/24181#discussion_r4544817760
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/OffsetsRequestManager.java:
##########
@@ -339,10 +344,13 @@ private CompletableFuture<Void>
updatePositionsWithOffsets(long deadlineMs) {
CompletableFuture<Void> updatePositions;
final Set<TopicPartition> initializingPartitions =
subscriptionState.initializingPartitions();
if (commitRequestManager != null) {
- CompletableFuture<Void> refreshWithCommittedOffsets =
initWithCommittedOffsetsIfNeeded(initializingPartitions, deadlineMs);
+ CompletableFuture<Boolean> refreshWithCommittedOffsets =
initWithCommittedOffsetsIfNeeded(initializingPartitions, deadlineMs);
- // Reset positions for all partitions that may still require it
(or that are awaiting reset)
- updatePositions = refreshWithCommittedOffsets.thenCompose(__ ->
initWithPartitionOffsetsIfNeeded(initializingPartitions));
+ // Reset positions for all partitions that may still require it
(or that are awaiting reset), unless
+ // the committed offsets could not be retrieved because the member
is no longer in the group
+ updatePositions =
refreshWithCommittedOffsets.thenCompose(shouldResetPositions ->
shouldResetPositions ?
+ initWithPartitionOffsetsIfNeeded(initializingPartitions) :
+ CompletableFuture.completedFuture(null));
Review Comment:
Adopted this shape, using `.thenCompose(f -> f)` and keeping the logging in
`refreshOffsets` for the reasons explained in the related thread
(https://github.com/apache/kafka/pull/24181#discussion_r4541072001).
--
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]