sunm2n commented on code in PR #24181:
URL: https://github.com/apache/kafka/pull/24181#discussion_r4544804228
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/OffsetsRequestManager.java:
##########
@@ -473,14 +490,32 @@ private void refreshOffsets(final Map<TopicPartition,
OffsetAndMetadata> offsets
refreshCommittedOffsets(offsetsToApply, metadata,
subscriptionState);
- result.complete(null);
-
+ result.complete(true);
+
+ } else if (isMemberNotInGroupError(error)) {
+ // The member stopped being part of the group while the
OffsetFetch request was in flight (ex. fenced,
+ // left or failed). The partitions may be reassigned after the
member rejoins, so do not fall back to
+ // resetting positions, and do not fail the update. Positions will
be refreshed with the committed
+ // offsets on a following call to updateFetchPositions, if the
partitions are still assigned.
+ log.info("Skipping position initialization because the OffsetFetch
failed with {} (member no longer " +
+ "in the group). Positions will be initialized on a following
poll if the partitions are still " +
+ "assigned.", Errors.forException(error));
+ result.complete(false);
} else {
log.error("Error fetching committed offsets to update positions",
error);
result.completeExceptionally(error);
}
}
+ /**
+ * Check if the given error, received in response to an OffsetFetch
request, indicates that the member
+ * is no longer a valid member of the group (ex. it was fenced, left the
group or failed).
+ */
+ private static boolean isMemberNotInGroupError(Throwable error) {
Review Comment:
Good point, renamed to `memberFencedOrLeft` and updated the comments that
used the same "no longer in the group" wording.
--
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]