kevin-wu24 commented on code in PR #18949:
URL: https://github.com/apache/kafka/pull/18949#discussion_r1980343813
##########
core/src/main/scala/kafka/server/DynamicBrokerConfig.scala:
##########
@@ -192,6 +197,37 @@ object DynamicBrokerConfig {
}
props
}
+
+ private[server] def readDynamicBrokerConfigsFromSnapshot(
+ raftManager: KafkaRaftManager[ApiMessageAndVersion],
+ config: KafkaConfig,
+ quotaManagers: QuotaFactory.QuotaManagers
+ ): Unit = {
+ raftManager.replicatedLog.latestSnapshotId().ifPresent(latestSnapshotId =>
{
+
raftManager.replicatedLog.readSnapshot(latestSnapshotId).ifPresent(rawSnapshotReader
=> {
+ val reader = RecordsSnapshotReader.of(
+ rawSnapshotReader,
+ raftManager.recordSerde,
+ BufferSupplier.create(),
+ KafkaRaftClient.MAX_BATCH_SIZE_BYTES,
+ true
+ )
+ val dynamicBrokerConfigs = new Properties()
+ while (reader.hasNext) {
+ val batch = reader.next()
+ batch.forEach(record => {
+ if (record.message().apiKey() ==
MetadataRecordType.CONFIG_RECORD.id) {
+ val configRecord = record.message().asInstanceOf[ConfigRecord]
+ if
(DynamicBrokerConfig.AllDynamicConfigs.contains(configRecord.name())) {
Review Comment:
The approach discussed in my previous comment covers this case, since we're
not checking the `value()` field of the `ConfigRecord` to determine whether or
not we put the key value pair into the `props` passed into
`processConfigChanges`. I assume `processConfigChanges` handles this `null`
value case already.
--
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]