kevin-wu24 commented on code in PR #18949:
URL: https://github.com/apache/kafka/pull/18949#discussion_r1980252103


##########
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:
   > This is not quite right, because you aren't distinguishing between broker 
configurations and other kinds of configuration. 
   
   Yeah I looked at `DynamicConfigPublisher`. I think when I get the 
`ConfigRecord`, I need to check that its `resourceName` is for `BROKER` and 
only put those configs in `dynamicBrokerConfigs`



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