dengziming commented on a change in pull request #11784:
URL: https://github.com/apache/kafka/pull/11784#discussion_r812650014



##########
File path: core/src/main/scala/kafka/server/BrokerServer.scala
##########
@@ -209,6 +211,11 @@ class BrokerServer(
 
       val controllerNodes = 
RaftConfig.voterConnectionsToNodes(controllerQuorumVotersFuture.get()).asScala
       val controllerNodeProvider = RaftControllerNodeProvider(raftManager, 
config, controllerNodes)
+      val currentNodeControllerApiVersions = if (config.isKRaftCoResidentMode) 
{
+        Some(new 
NodeApiVersions(ApiKeys.controllerApis().asScala.map(ApiVersionsResponse.toApiVersion).asJava))
+      } else {
+        None

Review comment:
       The `NodeApiVersions` is used in `BrokerToControllerChannelManager` to 
get controller ApiVersion only if the current node is both the broker and the 
controller(which only happen in KRaft co-resident mode or zk mode), otherwise 
it will connect the controller and send ApiversionRequest to get it. in other 
cases, it is not used so I just set it to None, and it will make no difference 
if I change it to Some(controllerApiVersion)




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


Reply via email to