akhileshchg commented on code in PR #12961: URL: https://github.com/apache/kafka/pull/12961#discussion_r1050065115
########## core/src/main/scala/kafka/server/metadata/ZkMetadataCache.scala: ########## @@ -248,7 +258,12 @@ class ZkMetadataCache(brokerId: Int, metadataVersion: MetadataVersion, brokerFea } override def getAliveBrokerNode(brokerId: Int, listenerName: ListenerName): Option[Node] = { - metadataSnapshot.aliveBrokers.get(brokerId).flatMap(_.getNode(listenerName)) + val snapshot = metadataSnapshot + brokerId match { + case id if snapshot.controllerId.filter(_.isInstanceOf[KRaftCachedControllerId]).exists(_.id == id) => + kraftControllerNodeMap.get(id) + case _ => snapshot.aliveBrokers.get(brokerId).flatMap(_.getNode(listenerName)) + } Review Comment: This is wrong. In Kraft brokers and Zk brokers with the KRaft controller, it always returns controller information for any broker node query. -- 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