chia7712 commented on code in PR #16302:
URL: https://github.com/apache/kafka/pull/16302#discussion_r1636665917
##########
core/src/main/scala/kafka/server/DynamicConfig.scala:
##########
@@ -30,10 +32,20 @@ import scala.jdk.CollectionConverters._
* and can only be set dynamically.
*/
object DynamicConfig {
+ object Broker {
+ private val brokerConfigs = {
+ val configs = QuotaConfigs.brokerQuotaConfigs()
+
+ // Filter and define all dynamic configurations
+ KafkaConfig.configKeys
+ .filter { case (configName, _) =>
AllDynamicConfigs.contains(configName) }
+ .foreach { case (_, config) => configs.define(config) }
+ configs
+ }
- object Broker {
- private val brokerConfigs = QuotaConfigs.brokerQuotaConfigs()
- DynamicBrokerConfig.addDynamicConfigs(brokerConfigs)
+ // Non-dynamic properties are determined by subtracting dynamic broker
config names from all config names.
Review Comment:
The key point is `DynamicBrokerConfig` should NOT have any `val` variables
which are initialized by `DynamicConfig.Broker`. Hence, the comments can be
tweaked to
```
In order to avoid circular reference, all DynamicBrokerConfig's variables
which are initialized by `DynamicConfig.Broker` should be moved to
`DynamicConfig.Broker`. Otherwise, those variables of DynamicBrokerConfig will
see intermediate state of `DynamicConfig.Broker`, because `brokerConfigs` is
created by `DynamicBrokerConfig.AllDynamicConfigs`
```
--
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]