chia7712 commented on code in PR #21377:
URL: https://github.com/apache/kafka/pull/21377#discussion_r2746708234
##########
core/src/main/scala/kafka/server/SharedServer.scala:
##########
@@ -282,7 +282,10 @@ class SharedServer(
controllerServerMetrics = new
ControllerMetadataMetrics(Optional.of(KafkaYammerMetrics.defaultRegistry()))
}
- val externalKRaftMetrics = new
DefaultExternalKRaftMetrics(Optional.ofNullable(brokerMetrics),
Optional.ofNullable(controllerServerMetrics))
+ val externalKRaftMetrics: ExternalKRaftMetrics = ignoredStaticVoters
=> {
+ if (brokerMetrics != null)
brokerMetrics.setIgnoredStaticVoters(ignoredStaticVoters)
Review Comment:
Would you mind creating a snapshot to avoid the race condition?
```scala
Option(brokerMetrics).foreach(_.setIgnoredStaticVoters(ignoredStaticVoters))
Option(controllerServerMetrics).foreach(_.setIgnoredStaticVoters(ignoredStaticVoters))
```
--
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]