chia7712 commented on a change in pull request #8826:
URL: https://github.com/apache/kafka/pull/8826#discussion_r528169002



##########
File path: 
clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java
##########
@@ -105,7 +105,9 @@ public AbstractConfig(ConfigDef definition, Map<?, ?> 
originals,  Map<String, ?>
                 throw new ConfigException(entry.getKey().toString(), 
entry.getValue(), "Key must be a string.");
 
         this.originals = resolveConfigVariables(configProviderProps, 
(Map<String, Object>) originals);
-        this.values = definition.parse(this.originals);
+        // pass a copy to definition.parse. Otherwise, the definition.parse 
adds all keys of definitions to "used" group
+        // since definition.parse needs to call "RecordingMap#get" when 
checking all definitions.
+        this.values = definition.parse(new HashMap<>(this.originals));

Review comment:
       > However, that code seems no longer necessary since we are now setting 
clientId in ProducerConfig.postProcessParsedConfig(). Could we just avoid 
constructing ProducerConfig there?
   
   I don't think so. The configs passed to configurable object is ```origins``` 
so the generated "client.id" is not included. However, your feedback inspires 
me that we don't need to create a new ```ProducerConfig```. Instead, we can use 
overrideConfig to set generated client.id to those configurable object. Will 
update it later.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to