CalvinConfluent commented on code in PR #15470: URL: https://github.com/apache/kafka/pull/15470#discussion_r1526685631
########## clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java: ########## @@ -2256,6 +2384,26 @@ void handleFailure(Throwable throwable) { return new HashMap<>(topicFutures); } + private TopicDescription getTopicDescriptionFromDescribeTopicsResponseTopic( + DescribeTopicPartitionsResponseTopic topic, + Map<Integer, Node> nodes + ) { + List<DescribeTopicPartitionsResponsePartition> partitionInfos = topic.partitions(); + List<TopicPartitionInfo> partitions = new ArrayList<>(partitionInfos.size()); + for (DescribeTopicPartitionsResponsePartition partitionInfo : partitionInfos) { + TopicPartitionInfo topicPartitionInfo = new TopicPartitionInfo( + partitionInfo.partitionIndex(), + nodes.get(partitionInfo.leaderId()), + partitionInfo.replicaNodes().stream().map(id -> nodes.get(id)).collect(Collectors.toList()), + partitionInfo.isrNodes().stream().map(id -> nodes.get(id)).collect(Collectors.toList()), + partitionInfo.eligibleLeaderReplicas().stream().map(id -> nodes.get(id)).collect(Collectors.toList()), + partitionInfo.lastKnownElr().stream().map(id -> nodes.get(id)).collect(Collectors.toList())); + partitions.add(topicPartitionInfo); + } + partitions.sort(Comparator.comparingInt(TopicPartitionInfo::partition)); Review Comment: Good catch, removed the sorting. The server already guarantees the partitioning order. -- 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