mumrah commented on code in PR #12961:
URL: https://github.com/apache/kafka/pull/12961#discussion_r1050076979
##########
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:
Ah, i see, i missed `exists` part. This could still be cleaned up with
pattern matching, but it's not critical for this PR
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]