jsancio commented on code in PR #12578:
URL: https://github.com/apache/kafka/pull/12578#discussion_r960954024


##########
metadata/src/main/java/org/apache/kafka/controller/ConfigurationControlManager.java:
##########
@@ -248,33 +249,45 @@ private void 
incrementalAlterConfigResource(ConfigResource configResource,
     }
 
     private ApiError validateAlterConfig(ConfigResource configResource,
-                                         List<ApiMessageAndVersion> newRecords,
+                                         List<ApiMessageAndVersion> 
recordsExplicitlyAltered,
+                                         List<ApiMessageAndVersion> 
recordsImplicitlyDeleted,
                                          boolean newlyCreatedResource) {
         Map<String, String> allConfigs = new HashMap<>();
-        Map<String, String> alteredConfigs = new HashMap<>();
+        Map<String, String> alteredConfigsForAlterConfigPolicyCheck = new 
HashMap<>();
         TimelineHashMap<String, String> existingConfigs = 
configData.get(configResource);
         if (existingConfigs != null) allConfigs.putAll(existingConfigs);
-        for (ApiMessageAndVersion newRecord : newRecords) {
+        for (ApiMessageAndVersion newRecord : recordsExplicitlyAltered) {
             ConfigRecord configRecord = (ConfigRecord) newRecord.message();
             if (configRecord.value() == null) {
                 allConfigs.remove(configRecord.name());
             } else {
                 allConfigs.put(configRecord.name(), configRecord.value());
             }
-            alteredConfigs.put(configRecord.name(), configRecord.value());
+            alteredConfigsForAlterConfigPolicyCheck.put(configRecord.name(), 
configRecord.value());
+        }
+        for (ApiMessageAndVersion recordImplicitlyDeleted : 
recordsImplicitlyDeleted) {
+            ConfigRecord configRecord = (ConfigRecord) 
recordImplicitlyDeleted.message();
+            allConfigs.remove(configRecord.name());
+            // As per KAFKA-14039, do not include implicit deletions caused by 
using the legacy AlterConfigs API
+            // in the list passed to the policy in order to maintain backwards 
compatibility

Review Comment:
   Should this documentation come before the lines 269-270?



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