cmccabe commented on code in PR #18949: URL: https://github.com/apache/kafka/pull/18949#discussion_r1999664781
########## 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: > I assume processConfigChanges handles this null value case already. Sorry, but this would be an incorrect assumption! We don't seem to have special handling for null values in the code that translates the `dynamicBrokerConfigs` map into a `Properties` object. Let's just handle this properly by removing the key/value pair from that map when a null value shows up. -- 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