hudeqi commented on code in PR #13913:
URL: https://github.com/apache/kafka/pull/13913#discussion_r1259093047


##########
connect/mirror/src/main/java/org/apache/kafka/connect/mirror/MirrorSourceConnector.java:
##########
@@ -581,13 +582,23 @@ void incrementalAlterConfigs(Map<String, Config> 
topicConfigs) {
         }));
     }
 
-    private void updateTopicAcls(List<AclBinding> bindings) {
-        log.trace("Syncing {} topic ACL bindings.", bindings.size());
-        targetAdminClient.createAcls(bindings).values().forEach((k, v) -> 
v.whenComplete((x, e) -> {
-            if (e != null) {
-                log.warn("Could not sync ACL of topic {}.", 
k.pattern().name(), e);
-            }
-        }));
+    // Visible for testing
+    int updateTopicAcls(List<AclBinding> bindings) {
+        Set<AclBinding> addBindings = new HashSet<>(bindings);
+        addBindings.removeAll(knownTopicAclBindings);
+        int newBindCount = addBindings.size();
+        if (!addBindings.isEmpty()) {
+            log.info("Syncing new found {} topic ACL bindings.", newBindCount);
+            targetAdminClient.createAcls(addBindings).values().forEach((k, v) 
-> v.whenComplete((x, e) -> {
+                if (e != null) {
+                    log.warn("Could not sync ACL of topic {}.", 
k.pattern().name(), e);
+                }
+            }));
+            knownTopicAclBindings = new HashSet<>(bindings);

Review Comment:
   nice cacth !



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