cmccabe commented on code in PR #16006:
URL: https://github.com/apache/kafka/pull/16006#discussion_r1608921813


##########
core/src/main/scala/kafka/server/metadata/ZkMetadataCache.scala:
##########
@@ -350,11 +347,7 @@ class ZkMetadataCache(
 
   override def getAliveBrokerNode(brokerId: Int, listenerName: ListenerName): 
Option[Node] = {
     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))
-    }
+    snapshot.aliveBrokers.get(brokerId).flatMap(_.getNode(listenerName))

Review Comment:
   I recall why we did this now (I didn't originally)...
   
   During ZK migration, we wanted a way to make the controller node provider 
work with both ZK and KRaft controllers.
   
   The correct way to do this is just to consult `RaftManager` for the endpoint 
when we're dealing with a KRaft controller (which we do know)
   
   But at the time, we "hacked" it by adding the controllers to the cache as 
"brokers" for some functions but not others (ew)



-- 
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

Reply via email to