TaiJuWu commented on code in PR #21127:
URL: https://github.com/apache/kafka/pull/21127#discussion_r2776716613
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/OffsetFetcher.java:
##########
@@ -271,8 +273,23 @@ private void validatePositionsAsync(Map<TopicPartition,
FetchPosition> partition
subscriptions.setNextAllowedRetry(fetchPositions.keySet(),
nextResetTimeMs);
+ // Convert TopicPartition to TopicIdPartition
+ Map<TopicIdPartition, FetchPosition> fetchPositionsWithId = new
HashMap<>();
+ Map<String, Uuid> topicIds = metadata.topicIds();
+ fetchPositions.forEach((tp, position) -> {
+ Uuid topicId = topicIds.get(tp.topic());
+ if (topicId != null) {
+ TopicIdPartition tip = new TopicIdPartition(topicId, tp);
+ fetchPositionsWithId.put(tip, position);
+ } else {
+ // Topic ID not available yet, skip this partition for now
+ // The metadata will be refreshed and we'll retry
+ log.debug("Skipping offset validation for partition {}
because topic ID is not available in metadata", tp);
+ }
+ });
Review Comment:
Nice catch, I always forget we need to support old broker :(
--
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]