lbradstreet commented on code in PR #20061: URL: https://github.com/apache/kafka/pull/20061#discussion_r2188841892
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java: ########## @@ -8165,10 +8160,11 @@ public Map.Entry<AlterShareGroupOffsetsResponseData, InitializeShareGroupStatePa Map<Uuid, Map<Integer, Long>> offsetByTopicPartitions = new HashMap<>(); alterShareGroupOffsetsRequest.topics().forEach(topic -> { - TopicImage topicImage = metadataImage.topics().getTopic(topic.topicName()); - if (topicImage != null) { - Uuid topicId = topicImage.id(); - Set<Integer> existingPartitions = new HashSet<>(topicImage.partitions().keySet()); + Optional<CoordinatorMetadataImage.TopicMetadata> topicMetadataOpt = metadataImage.topicMetadata(topic.topicName()); + if (topicMetadataOpt.isPresent()) { + var topicMetadata = topicMetadataOpt.get(); + Uuid topicId = topicMetadata.id(); + Set<Integer> existingPartitions = IntStream.range(0, topicMetadata.partitionCount()).boxed().collect(Collectors.toSet()); Review Comment: Generating this set seems pretty overkill too. I think we can just delete the set creation and do something like this? ``` if (partition.partitionIndex() < topicMetadata.partitionCount()) { partitions.add( ``` -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org