lbradstreet commented on code in PR #20061: URL: https://github.com/apache/kafka/pull/20061#discussion_r2188845482
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java: ########## @@ -2727,18 +2724,17 @@ Map<Uuid, InitMapValue> subscribedTopicsChangeMap(String groupId, Set<String> su // Here will add any topics which are subscribed but not initialized and initializing // topics whose timestamp indicates that they are older than delta elapsed. subscriptionTopicNames.forEach(topicName -> { - TopicImage topicImage = metadataImage.topics().getTopic(topicName); - if (topicImage != null) { - Set<Integer> alreadyInitializedPartSet = alreadyInitialized.containsKey(topicImage.id()) ? alreadyInitialized.get(topicImage.id()).partitions() : Set.of(); - if (alreadyInitializedPartSet.isEmpty() || alreadyInitializedPartSet.size() < topicImage.partitions().size()) { - Set<Integer> partitionSet = IntStream.range(0, topicImage.partitions().size()).boxed() + metadataImage.topicMetadata(topicName).ifPresent(topicMetadata -> { + Set<Integer> alreadyInitializedPartSet = alreadyInitialized.containsKey(topicMetadata.id()) ? alreadyInitialized.get(topicMetadata.id()).partitions() : Set.of(); + if (alreadyInitializedPartSet.isEmpty() || alreadyInitializedPartSet.size() < topicMetadata.partitionCount()) { + Set<Integer> partitionSet = IntStream.range(0, topicMetadata.partitionCount()).boxed() Review Comment: this is preexisting, but I think we could move the partitionSet calculation into the computeIfAbsent? -- 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