m1a2st commented on code in PR #19803: URL: https://github.com/apache/kafka/pull/19803#discussion_r2106231485
########## metadata/src/main/java/org/apache/kafka/metadata/MetadataCache.java: ########## @@ -148,56 +147,53 @@ DescribeTopicPartitionsResponseData describeTopicResponse( boolean ignoreTopicsWithExceptions); static Cluster toCluster(String clusterId, MetadataImage image) { - Map<Integer, List<Node>> brokerToNodes = new HashMap<>(); - image.cluster().brokers().values().stream() - .filter(broker -> !broker.fenced()) - .forEach(broker -> brokerToNodes.put(broker.id(), broker.nodes())); + Map<Integer, Node> nodesById = image.cluster().brokers().values().stream() + .collect(Collectors.toMap(BrokerRegistration::id, broker -> broker.nodes().get(0))); Review Comment: I'm not sure, but I'm a bit confused — shouldn't the partition leader broker not be a fenced broker? In [KIP-841](https://cwiki.apache.org/confluence/display/KAFKA/KIP-841:+Fenced+replicas+should+not+be+allowed+to+join+the+ISR+in+KRaft) has following invariants - a fenced or in-controlled-shutdown replica is not eligible to be in the ISR; and - a fenced or in-controlled-shutdown replica is not eligible to become leader. -- 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