peterxcli commented on code in PR #18310: URL: https://github.com/apache/kafka/pull/18310#discussion_r1897059235
########## core/src/main/scala/kafka/server/ControllerServer.scala: ########## @@ -155,6 +156,11 @@ class ControllerServer( () => featuresPublisher.features() ) + // metrics will be set to null when closing a controller, so we should recreate it for testing + if (sharedServer.metrics == null){ Review Comment: Hi, @chia7712 Thanks for your review. Regarding the `BrokerServer`, it calls `sharedServer.startForBroker()` at the beginning of the `startup` method, which also [checks if the metrics are null](https://github.com/apache/kafka/blob/ccbb73111c0d4bf1c999e8dd5f9f111393508046/core/src/main/scala/kafka/server/SharedServer.scala#L266-L270) However, we cannot apply the same approach to the `ControllerServer` because `sharedServer.startForController()` in it depends on `listenerInfo`. Therefore, this change is necessary. Here is the relevant reference: - [BrokerServer startup method](https://github.com/apache/kafka/blob/ebb3202e01d9481d7e711cd25e4e564863b91e1e/core/src/main/scala/kafka/server/BrokerServer.scala#L187-L616) - [listenerInfo dependence in ControllerServer](https://github.com/apache/kafka/blob/7408623bb65c182404d5ce70b50c480c41f1abc2/core/src/main/scala/kafka/server/ControllerServer.scala#L166-L190) -- 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