splett2 commented on code in PR #13707:
URL: https://github.com/apache/kafka/pull/13707#discussion_r1191702662
##########
core/src/main/scala/kafka/server/KafkaConfig.scala:
##########
@@ -1956,10 +1956,10 @@ class KafkaConfig private(doLog: Boolean, val props:
java.util.Map[_, _], dynami
val transactionTopicSegmentBytes =
getInt(KafkaConfig.TransactionsTopicSegmentBytesProp)
val transactionAbortTimedOutTransactionCleanupIntervalMs =
getInt(KafkaConfig.TransactionsAbortTimedOutTransactionCleanupIntervalMsProp)
val transactionRemoveExpiredTransactionalIdCleanupIntervalMs =
getInt(KafkaConfig.TransactionsRemoveExpiredTransactionalIdCleanupIntervalMsProp)
-
+
val transactionPartitionVerificationEnable =
getBoolean(KafkaConfig.TransactionPartitionVerificationEnableProp)
- val producerIdExpirationMs = getInt(KafkaConfig.ProducerIdExpirationMsProp)
+ def producerIdExpirationMs = getInt(KafkaConfig.ProducerIdExpirationMsProp)
Review Comment:
The dynamic broker config code is quite hairy. I took a look and my
high-level understanding what it does is the following:
`DynamicBrokerConfig.updateCurrentConfig`: Try to generate a new
`KafkaConfig` from the set of properties persisted to Zookeeper. If the current
config is equal to the new config, no-op. Otherwise, determine the set of
reconfigurables that need to be updated based on the currently registered set
of reconfigurables, apply those updates. Then update the current config.
I added some logging and it looks like what is happening is the following:
1. During `KafkaServer.startup()` we call
`config.dynamicConfig.initialize(Some(zkClient))`. At this point, the set of
recconfigurables is empty.
2. Many lines of code later, we call:
```
/* Add all reconfigurables for config change notification before
starting config handlers */
config.dynamicConfig.addReconfigurables(this)
Option(logManager.cleaner).foreach(config.dynamicConfig.addBrokerReconfigurable)
```
3. Eventually we start up the config manager which tries to reload props
from Zookeeper.
Step #1 loads broker overrides from Zookeeper, but doesn't apply any changes
since we have not added the reconfigurables yet. This means that the props just
get applied to the current KafkaConfig, and the reconfiguration hooks defined
in `DynamicBrokerConfig` don't fire. However, we do update the current
KafkaConfig to include the updated props.
Step #2 adds the reconfigurables so that post-startup configuration changes
alter components.
Step #3 tries to load from Zookeeper the base props, but because #1 has
already updated the current KafkaConfig to match the existing ZK state, we
no-op again.
--
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]