cmccabe commented on code in PR #18949:
URL: https://github.com/apache/kafka/pull/18949#discussion_r1980322181


##########
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:
   That is correct. For pedantic correctness, you should also handle the case 
where we're setting it to null (by deleting it) although I don't expect that to 
occur in a snapshot.



-- 
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

Reply via email to