fvaleri commented on code in PR #23843:
URL: https://github.com/apache/kafka/pull/23843#discussion_r4414376647


##########
mirror-coordinator/src/main/java/org/apache/kafka/coordinator/mirror/ClusterMirrorConfig.java:
##########
@@ -0,0 +1,532 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.mirror;
+
+import org.apache.kafka.clients.CommonClientConfigs;
+import org.apache.kafka.common.acl.AclBinding;
+import org.apache.kafka.common.acl.AclOperation;
+import org.apache.kafka.common.acl.AclPermissionType;
+import org.apache.kafka.common.config.AbstractConfig;
+import org.apache.kafka.common.config.ConfigDef;
+import org.apache.kafka.common.config.ConfigException;
+import org.apache.kafka.common.config.SaslConfigs;
+import org.apache.kafka.common.config.SecurityConfig;
+import org.apache.kafka.common.config.SslConfigs;
+import org.apache.kafka.common.resource.ResourceType;
+import org.apache.kafka.common.security.auth.SecurityProtocol;
+import org.apache.kafka.common.utils.Utils;
+
+import com.google.re2j.Pattern;
+import com.google.re2j.PatternSyntaxException;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+import java.util.Properties;
+
+import static org.apache.kafka.common.config.ConfigDef.Importance.HIGH;
+import static org.apache.kafka.common.config.ConfigDef.Importance.LOW;
+import static org.apache.kafka.common.config.ConfigDef.Importance.MEDIUM;
+import static org.apache.kafka.common.config.ConfigDef.Range.atLeast;
+import static org.apache.kafka.common.config.ConfigDef.Type.INT;
+import static org.apache.kafka.common.config.ConfigDef.Type.LIST;
+import static org.apache.kafka.common.config.ConfigDef.Type.LONG;
+import static org.apache.kafka.common.config.ConfigDef.Type.STRING;
+import static org.apache.kafka.server.util.MirrorUtils.compilePattern;
+import static org.apache.kafka.server.util.MirrorUtils.compilePatternList;
+
+/**
+ * Cluster Mirror configurations.
+ * Set when creating/altering a specific mirror.
+ * Stored in cluster metadata.
+ */
+public final class ClusterMirrorConfig extends AbstractConfig {
+    public static final String BOOTSTRAP_SERVERS_CONFIG = 
CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG;
+    private static final String BOOTSTRAP_SERVERS_DOC = "A list of host/port 
pairs to use for establishing the initial connection to the source cluster. " +
+            "This is a required configuration when creating a cluster mirror.";
+
+    public static final String SOURCE_CLUSTER_ID_CONFIG = 
CommonClientConfigs.SOURCE_CLUSTER_ID_CONFIG;
+    private static final String SOURCE_CLUSTER_ID_DOC = 
CommonClientConfigs.SOURCE_CLUSTER_ID_DOC;
+
+    public static final String REQUEST_TIMEOUT_MS_CONFIG = 
CommonClientConfigs.REQUEST_TIMEOUT_MS_CONFIG;
+    private static final String REQUEST_TIMEOUT_MS_DOC = 
CommonClientConfigs.REQUEST_TIMEOUT_MS_DOC;
+    private static final int REQUEST_TIMEOUT_MS_DEFAULT = 30 * 1000;
+
+    public static final String CONNECTION_SETUP_TIMEOUT_MS_CONFIG = 
CommonClientConfigs.SOCKET_CONNECTION_SETUP_TIMEOUT_MS_CONFIG;
+    private static final String CONNECTION_SETUP_TIMEOUT_MS_DOC = 
CommonClientConfigs.SOCKET_CONNECTION_SETUP_TIMEOUT_MS_DOC;
+    private static final long CONNECTION_SETUP_TIMEOUT_MS_DEFAULT = 
CommonClientConfigs.DEFAULT_SOCKET_CONNECTION_SETUP_TIMEOUT_MS;
+
+    public static final String CONNECTION_SETUP_TIMEOUT_MAX_MS_CONFIG = 
CommonClientConfigs.SOCKET_CONNECTION_SETUP_TIMEOUT_MAX_MS_CONFIG;
+    private static final String CONNECTION_SETUP_TIMEOUT_MAX_MS_DOC = 
CommonClientConfigs.SOCKET_CONNECTION_SETUP_TIMEOUT_MAX_MS_DOC;
+    private static final long CONNECTION_SETUP_TIMEOUT_MAX_MS_DEFAULT = 
CommonClientConfigs.DEFAULT_SOCKET_CONNECTION_SETUP_TIMEOUT_MAX_MS;
+
+    public static final String CONNECTIONS_MAX_IDLE_MS_CONFIG = 
CommonClientConfigs.CONNECTIONS_MAX_IDLE_MS_CONFIG;
+    private static final String CONNECTIONS_MAX_IDLE_MS_DOC = 
CommonClientConfigs.CONNECTIONS_MAX_IDLE_MS_DOC;
+    private static final long CONNECTIONS_MAX_IDLE_MS_DEFAULT = 10 * 60 * 
1000L;
+
+    public static final String SOCKET_TIMEOUT_MS_CONFIG = "socket.timeout.ms";
+    private static final String SOCKET_TIMEOUT_MS_DOC = "The socket timeout 
for network requests.";
+    private static final int SOCKET_TIMEOUT_MS_DEFAULT = 30 * 1000;
+
+    public static final String SOCKET_RECEIVE_BUFFER_BYTES_CONFIG = 
"socket.receive.buffer.bytes";
+    private static final String SOCKET_RECEIVE_BUFFER_BYTES_DOC = "The socket 
receive buffer for network requests to the source cluster.";
+    private static final int SOCKET_RECEIVE_BUFFER_BYTES_DEFAULT = 64 * 1024;
+
+    public static final String FETCH_WAIT_MAX_MS_CONFIG = "fetch.wait.max.ms";
+    private static final String FETCH_WAIT_MAX_MS_DOC = "The maximum wait time 
for each fetcher request issued by mirror replicas.";
+    private static final int FETCH_WAIT_MAX_MS_DEFAULT = 1000;
+
+    public static final String FETCH_BACKOFF_MS_CONFIG = "fetch.backoff.ms";
+    private static final String FETCH_BACKOFF_MS_DOC = "The amount of time to 
wait before retrying mirror fetch requests after a failure. " +
+            "This controls the backoff for mirror fetcher threads on 
connection errors or other exceptions from the source cluster.";
+    private static final long FETCH_BACKOFF_MS_DEFAULT = 1000;
+
+    public static final String FETCH_MIN_BYTES_CONFIG = "fetch.min.bytes";
+    private static final String FETCH_MIN_BYTES_DOC = "Minimum bytes expected 
for each fetch response.";
+    private static final int FETCH_MIN_BYTES_DEFAULT = 1;
+
+    public static final String FETCH_RESPONSE_MAX_BYTES_CONFIG = 
"fetch.response.max.bytes";
+    private static final String FETCH_RESPONSE_MAX_BYTES_DOC = "Maximum bytes 
expected for the entire fetch response. Records are fetched in batches, " +
+            "and if the first record batch in the first non-empty partition is 
larger than this value, the record batch will still be returned.";
+    private static final int FETCH_RESPONSE_MAX_BYTES_DEFAULT = 10 * 1024 * 
1024;
+
+    public static final String FETCH_MAX_BYTES_CONFIG = "fetch.max.bytes";
+    private static final String FETCH_MAX_BYTES_DOC = "The number of bytes of 
messages to attempt to fetch for each partition.";
+    private static final int FETCH_MAX_BYTES_DEFAULT = 1024 * 1024;
+
+    public static final String TOPIC_PROPERTIES_EXCLUDE_CONFIG = 
"topic.properties.exclude";
+    private static final String TOPIC_PROPERTIES_EXCLUDE_DOC = "A 
comma-separated list of topic config property names and/or regexes to exclude 
from synchronization. "
+            + "Properties in this list will not be replicated from the source 
cluster.";
+    // The message.timestamp.difference.max.ms property was removed in 4.0 but 
may still be used by older clusters
+    private static final String TOPIC_PROPERTIES_EXCLUDE_DEFAULT =
+            "follower.replication.throttled.replicas,"
+                    + "leader.replication.throttled.replicas,"
+                    + "message.timestamp.difference.max.ms,"
+                    + "message.timestamp.before.max.ms,"
+                    + "message.timestamp.after.max.ms,"
+                    + "message.timestamp.type,"
+                    + "unclean.leader.election.enable,"
+                    + "min.insync.replicas,"
+                    + "mirror.replication.throttled.replicas,"
+                    + "mirror.unclean.leader.election.enable";
+
+    public static final String TOPICS_INCLUDE_CONFIG = "topics.include";
+    private static final String TOPICS_INCLUDE_DOC = "A comma-separated list 
of regex patterns for topic names to include in mirroring. "
+            + "Topics on the source cluster whose names match at least one of 
the patterns will be automatically discovered and mirrored.";
+    private static final String TOPICS_INCLUDE_DEFAULT = ".*";
+
+    public static final String TOPICS_EXCLUDE_CONFIG = "topics.exclude";
+    private static final String TOPICS_EXCLUDE_DOC = "A comma-separated list 
of regex patterns for topic names to exclude from mirroring. "
+            + "Internal topics are excluded by default. Exclusions take 
precedence over inclusions.";
+    private static final String TOPICS_EXCLUDE_DEFAULT = "__.*";
+
+    public static final String GROUPS_INCLUDE_CONFIG = "groups.include";
+    private static final String GROUPS_INCLUDE_DOC = "A comma-separated list 
of regex patterns for consumer group IDs to include in offset synchronization. "
+            + "Only consumer groups whose IDs match at least one of the 
patterns will have their offsets replicated from the source cluster.";
+    private static final String GROUPS_INCLUDE_DEFAULT = ".*";
+
+    public static final String GROUPS_EXCLUDE_CONFIG = "groups.exclude";
+    private static final String GROUPS_EXCLUDE_DOC = "A comma-separated list 
of regex patterns for consumer group IDs to exclude from offset 
synchronization. " +
+            "Exclusions take precedence over inclusions.";
+    private static final String GROUPS_EXCLUDE_DEFAULT = "";
+
+    public static final String ACLS_INCLUDE_CONFIG = "acls.include";
+    private static final String ACLS_INCLUDE_DOC = "ACL include rules. " + 
MirrorAclRule.DOC
+            + "Examples: .* (match all ACLs), TOPIC;orders.* (all ACLs for 
topics matching orders.*), "
+            + "TOPIC;.*;READ;ALLOW||TOPIC;.*;WRITE;ALLOW (all topic READ and 
WRITE ALLOW ACLs), "
+            + "ANY;.*;ANY;ANY;User:alice (all ACLs for principal User:alice).";

Review Comment:
   Fixed and aligned with the KIP.



##########
mirror-coordinator/src/test/java/org/apache/kafka/coordinator/mirror/ClusterMirrorConfigTest.java:
##########
@@ -0,0 +1,775 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.mirror;
+
+import org.apache.kafka.common.acl.AccessControlEntry;
+import org.apache.kafka.common.acl.AclBinding;
+import org.apache.kafka.common.acl.AclOperation;
+import org.apache.kafka.common.acl.AclPermissionType;
+import org.apache.kafka.common.config.ConfigException;
+import org.apache.kafka.common.config.SaslConfigs;
+import org.apache.kafka.common.config.SslConfigs;
+import org.apache.kafka.common.resource.PatternType;
+import org.apache.kafka.common.resource.ResourcePattern;
+import org.apache.kafka.common.resource.ResourceType;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Properties;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class ClusterMirrorConfigTest {
+    @Test
+    public void testFromPropertiesWithDefaults() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.BOOTSTRAP_SERVERS_CONFIG, 
"localhost:9092");
+        props.setProperty(ClusterMirrorConfig.SOURCE_CLUSTER_ID_CONFIG, 
"source-cluster");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals("localhost:9092", 
config.originals().get(ClusterMirrorConfig.BOOTSTRAP_SERVERS_CONFIG));
+        assertEquals("source-cluster", 
config.originals().get(ClusterMirrorConfig.SOURCE_CLUSTER_ID_CONFIG));
+        assertEquals(1000, config.fetchWaitMaxMs());
+    }
+
+    @Test
+    public void testFromPropertiesWithCustomValues() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.BOOTSTRAP_SERVERS_CONFIG, 
"broker1:9092,broker2:9092");
+        props.setProperty(ClusterMirrorConfig.FETCH_WAIT_MAX_MS_CONFIG, 
"5000");
+        props.setProperty(ClusterMirrorConfig.TOPICS_INCLUDE_CONFIG, 
"topic1,topic2");
+        props.setProperty(ClusterMirrorConfig.TOPICS_EXCLUDE_CONFIG, "__.*");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(5000, config.fetchWaitMaxMs());
+        assertNotNull(config.topicsIncludePattern());
+        assertNotNull(config.topicsExcludePattern());
+    }
+
+    @Test
+    public void testTopicPropertiesExclude() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.TOPIC_PROPERTIES_EXCLUDE_CONFIG,
+                
"leader.replication.throttled.replicas,follower.replication.throttled.replicas");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertNotNull(config.topicPropertiesExcludePattern());
+        assertTrue(config.topicPropertiesExcludePattern()
+                .matcher("leader.replication.throttled.replicas").matches());
+        assertFalse(config.topicPropertiesExcludePattern()
+                .matcher("some.other.property").matches());
+    }
+
+    @Test
+    public void testTopicPropertiesExcludeWithRegex() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.TOPIC_PROPERTIES_EXCLUDE_CONFIG, 
"min.*,max.*");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        
assertTrue(config.topicPropertiesExcludePattern().matcher("min.insync.replicas").matches());
+        
assertTrue(config.topicPropertiesExcludePattern().matcher("max.message.bytes").matches());
+        
assertFalse(config.topicPropertiesExcludePattern().matcher("cleanup.policy").matches());
+    }
+
+    @Test
+    public void testTopicsInclude() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.TOPICS_INCLUDE_CONFIG, 
"test.*,prod.*");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        
assertTrue(config.topicsIncludePattern().matcher("test-topic").matches());
+        
assertTrue(config.topicsIncludePattern().matcher("prod-topic").matches());
+        
assertFalse(config.topicsIncludePattern().matcher("staging").matches());
+    }
+
+    @Test
+    public void testTopicsIncludeAll() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.TOPICS_INCLUDE_CONFIG, ".*");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        
assertTrue(config.topicsIncludePattern().matcher("any-topic").matches());
+        assertTrue(config.topicsIncludePattern().matcher("test").matches());
+    }
+
+    @Test
+    public void testTopicsIncludeWithEmpty() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.TOPICS_INCLUDE_CONFIG, "");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertNull(config.topicsIncludePattern());
+    }
+
+    @Test
+    public void testTopicsIncludePatternWithWhitespaces() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.TOPICS_INCLUDE_CONFIG, "   ");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertNull(config.topicsIncludePattern());
+    }
+
+    @Test
+    public void testTopicsIncludeWihInvalidRegex() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.TOPICS_INCLUDE_CONFIG, 
"test[invalid");
+
+        ConfigException ex = assertThrows(ConfigException.class, () -> 
ClusterMirrorConfig.fromProperties(props));
+        assertTrue(ex.getMessage().contains("Invalid regex pattern"));
+    }
+
+    @Test
+    public void testTopicsExclude() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.TOPICS_EXCLUDE_CONFIG, 
"__.*,internal-.*");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        
assertTrue(config.topicsExcludePattern().matcher("__consumer_offsets").matches());
+        
assertTrue(config.topicsExcludePattern().matcher("internal-topic").matches());
+        
assertFalse(config.topicsExcludePattern().matcher("user-topic").matches());
+    }
+
+    @Test
+    public void testTopicsExcludeAll() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.TOPICS_EXCLUDE_CONFIG, ".*");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        
assertTrue(config.topicsExcludePattern().matcher("any-topic").matches());
+        assertTrue(config.topicsExcludePattern().matcher("test").matches());
+    }
+
+    @Test
+    public void testTopicsExcludeWithEmpty() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.TOPICS_EXCLUDE_CONFIG, "");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertNull(config.topicsExcludePattern());
+    }
+
+    @Test
+    public void testTopicsExcludeWithWhitespaces() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.TOPICS_EXCLUDE_CONFIG, "   ");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertNull(config.topicsExcludePattern());
+    }
+
+    @Test
+    public void testGroupsInclude() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.GROUPS_INCLUDE_CONFIG, "app.*");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        
assertTrue(config.groupsIncludePattern().matcher("app-group-1").matches());
+        
assertFalse(config.groupsIncludePattern().matcher("test-group").matches());
+    }
+
+    @Test
+    public void testGroupsIncludeAll() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.GROUPS_INCLUDE_CONFIG, ".*");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        
assertTrue(config.groupsIncludePattern().matcher("any-group").matches());
+        assertTrue(config.groupsIncludePattern().matcher("test").matches());
+    }
+
+    @Test
+    public void testGroupsIncludeWithEmpty() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.GROUPS_INCLUDE_CONFIG, "");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertNull(config.groupsIncludePattern());
+    }
+
+    @Test
+    public void testGroupsIncludeWithWhitespaces() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.GROUPS_INCLUDE_CONFIG, "   ");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertNull(config.groupsIncludePattern());
+    }
+
+    @Test
+    public void testGroupsExclude() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.GROUPS_EXCLUDE_CONFIG, 
"console-.*");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        
assertTrue(config.groupsExcludePattern().matcher("console-consumer").matches());
+        
assertFalse(config.groupsExcludePattern().matcher("my-group").matches());
+    }
+
+    @Test
+    public void testGroupsExcludeAll() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.GROUPS_EXCLUDE_CONFIG, ".*");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        
assertTrue(config.groupsExcludePattern().matcher("any-group").matches());
+        assertTrue(config.groupsExcludePattern().matcher("test").matches());
+    }
+
+    @Test
+    public void testGroupsExcludeWithEmpty() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.GROUPS_EXCLUDE_CONFIG, "");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertNull(config.groupsExcludePattern());
+    }
+
+    @Test
+    public void testGroupsExcludeWithWhitespaces() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.GROUPS_EXCLUDE_CONFIG, "   ");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertNull(config.groupsExcludePattern());
+    }
+
+    @Test
+    public void testAclsInclude() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, "TOPIC;.*");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        assertEquals(ResourceType.TOPIC, rule.resourceType());
+    }
+
+    @Test
+    public void testAclsIncludeAll() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, ".*");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        assertEquals(ClusterMirrorConfig.MirrorAclRule.MATCH_ALL_RULE, rule);
+    }
+
+    @Test
+    public void testAclsIncludeWithMultipleFields() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"TOPIC;.*;.*;READ;ALLOW");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        assertEquals(ResourceType.TOPIC, rule.resourceType());
+        assertEquals(AclOperation.READ, rule.operation());
+        assertEquals(AclPermissionType.ALLOW, rule.permissionType());
+    }
+
+    @Test
+    public void testAclsIncludeWithExtraFields() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG,
+                "TOPIC;.*;.*;READ;ALLOW;User:alice;extrafield;moredata");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        assertEquals("User:alice;extrafield;moredata", rule.principal());
+        // Extra semicolons after the principal are preserved as part of the 
principal (split limit=6)
+        assertTrue(rule.principal().contains(";extrafield;moredata"));
+    }
+
+    @Test
+    public void testAclsIncludeWithPrincipal() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"TOPIC;.*;.*;READ;ALLOW;User:alice");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        assertEquals("User:alice", rule.principal());
+    }
+
+    @Test
+    public void testAclsIncludeWithWildcardPrincipal() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"TOPIC;.*;.*;READ;ALLOW;User:*");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        // User:* is a wildcard principal string
+        assertEquals("User:*", rule.principal());
+    }
+
+    @Test
+    public void testAclsIncludeWithPrincipalDN() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG,
+                
"TOPIC;.*;.*;READ;ALLOW;User:CN=billing-service,OU=Finance,O=Enterprise,L=London,C=GB");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        assertEquals(ResourceType.TOPIC, rule.resourceType());
+        assertEquals(AclOperation.READ, rule.operation());
+        assertEquals(AclPermissionType.ALLOW, rule.permissionType());
+        
assertEquals("User:CN=billing-service,OU=Finance,O=Enterprise,L=London,C=GB", 
rule.principal());
+    }
+
+    @Test
+    public void testAclsIncludeWithCommaContainingPrincipal() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG,
+                
"TOPIC;.*;.*;READ;ALLOW;User:CN=billing-service,OU=Finance,O=Enterprise,L=London,C=GB||TOPIC;.*;.*;WRITE;ALLOW;User:alice");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(2, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule1 = 
config.aclIncludeRules().get(0);
+        
assertEquals("User:CN=billing-service,OU=Finance,O=Enterprise,L=London,C=GB", 
rule1.principal());
+        assertEquals(AclOperation.READ, rule1.operation());
+        ClusterMirrorConfig.MirrorAclRule rule2 = 
config.aclIncludeRules().get(1);
+        assertEquals("User:alice", rule2.principal());
+        assertEquals(AclOperation.WRITE, rule2.operation());
+    }
+
+    @Test
+    public void testAclsIncludeWithPipeContainingPrincipal() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"TOPIC;.*;.*;READ;ALLOW;User:alice|bob");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        assertEquals("User:alice|bob", rule.principal());
+    }
+
+    @Test
+    public void testAclsIncludeIncludingEmpty() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_EXCLUDE_CONFIG, 
"TOPIC;.*;.*;WRITE||||CLUSTER;.*;.*;ALL;DENY");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(2, config.aclExcludeRules().size());
+    }
+
+    @Test
+    public void testAclsIncludeWithEmpty() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, "");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(0, config.aclIncludeRules().size());
+    }
+
+    @Test
+    public void testAclsIncludeWithWhitespaces() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, "   ");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(0, config.aclIncludeRules().size());
+    }
+
+    @Test
+    public void testAclsIncludeWithInvalidOperation() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"TOPIC;.*;.*;INVALID_OP;ALLOW");
+
+        ConfigException ex = assertThrows(ConfigException.class, () -> 
ClusterMirrorConfig.fromProperties(props));
+        assertTrue(ex.getMessage().contains("Invalid ACL rule"));
+    }
+
+    @Test
+    public void testAclsIncludeWithInvalidResource() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"INVALID_TYPE;.*;.*;READ");
+
+        ConfigException ex = assertThrows(ConfigException.class, () -> 
ClusterMirrorConfig.fromProperties(props));
+        assertTrue(ex.getMessage().contains("Invalid ACL rule"));
+    }
+
+    @Test
+    public void testAclsIncludeWithInvalidPermission() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"TOPIC;.*;.*;READ;INVALID_PERMISSION");
+
+        ConfigException ex = assertThrows(ConfigException.class, () -> 
ClusterMirrorConfig.fromProperties(props));
+        assertTrue(ex.getMessage().contains("Invalid ACL rule"));
+    }
+
+    @Test
+    public void testAclsIncludeWithWhitespaceInFields() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, "  TOPIC  ; 
 .*  ;  .*  ;  READ  ;  ALLOW  ;  User:alice  ");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        assertEquals(ResourceType.TOPIC, rule.resourceType());
+        assertEquals(AclOperation.READ, rule.operation());
+        assertEquals(AclPermissionType.ALLOW, rule.permissionType());
+        assertEquals("User:alice", rule.principal());
+    }
+
+    @Test
+    public void testAclsIncludeWithAnyResource() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"ANY;.*;.*;READ;ALLOW;User:alice");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        assertNull(rule.resourceType());
+    }
+
+    @Test
+    public void testAclsIncludeWithAnyOperation() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"TOPIC;.*;.*;ANY;ALLOW;User:alice");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        assertNull(rule.operation());
+    }
+
+    @Test
+    public void testAclsIncludeWithAnyPermission() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"TOPIC;.*;.*;READ;ANY;User:alice");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        assertNull(rule.permissionType());
+    }
+
+    @Test
+    public void testAclsIncludeWithUnknownResource() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"UNKNOWN;.*;.*;READ;ALLOW");
+
+        ConfigException ex = assertThrows(ConfigException.class, () -> 
ClusterMirrorConfig.fromProperties(props));
+        assertTrue(ex.getMessage().contains("Invalid ACL rule"));
+    }
+
+    @Test
+    public void testAclsIncludeWithUnknownOperation() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"TOPIC;.*;.*;UNKNOWN;ALLOW");
+
+        ConfigException ex = assertThrows(ConfigException.class, () -> 
ClusterMirrorConfig.fromProperties(props));
+        assertTrue(ex.getMessage().contains("Invalid ACL rule"));
+    }
+
+    @Test
+    public void testAclsIncludeWithUnknownPermission() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"TOPIC;.*;.*;READ;UNKNOWN");
+
+        ConfigException ex = assertThrows(ConfigException.class, () -> 
ClusterMirrorConfig.fromProperties(props));
+        assertTrue(ex.getMessage().contains("Invalid ACL rule"));
+    }
+
+    @Test
+    public void testAclsIncludeWithLowercaseResourceType() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"topic;.*;.*;read;allow");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        assertEquals(ResourceType.TOPIC, rule.resourceType());
+    }
+
+    @Test
+    public void testAclsIncludeWithLowercaseOperation() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"TOPIC;.*;.*;read;allow");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        assertEquals(AclOperation.READ, rule.operation());
+    }
+
+    @Test
+    public void testAclsIncludeWithLowercasePermissionType() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"TOPIC;.*;.*;READ;allow");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        assertEquals(AclPermissionType.ALLOW, rule.permissionType());
+    }
+
+    @Test
+    public void testAclsIncludeWithLowercaseAny() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"TOPIC;.*;.*;any;allow");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        assertNull(rule.operation());
+    }
+
+    @Test
+    public void testAclsIncludeWithLowercaseUnknown() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"TOPIC;.*;.*;unknown;allow");
+
+        ConfigException ex = assertThrows(ConfigException.class, () -> 
ClusterMirrorConfig.fromProperties(props));
+        assertTrue(ex.getMessage().contains("Invalid ACL rule"));
+    }
+
+    @Test
+    public void testAclsExclude() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_EXCLUDE_CONFIG, 
"TOPIC;.*;.*;WRITE");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclExcludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclExcludeRules().get(0);
+        assertEquals(ResourceType.TOPIC, rule.resourceType());
+        assertEquals(AclOperation.WRITE, rule.operation());
+    }
+
+    @Test
+    public void testAclsExcludeAll() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_EXCLUDE_CONFIG, ".*");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclExcludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclExcludeRules().get(0);
+        assertEquals(ClusterMirrorConfig.MirrorAclRule.MATCH_ALL_RULE, rule);
+    }
+
+    @Test
+    public void testAclRuleWithHost() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"TOPIC;test-.*;192\\.168\\..*;READ;ALLOW;User:alice");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        assertEquals(ResourceType.TOPIC, rule.resourceType());
+        assertNotNull(rule.hostPattern());
+        assertTrue(rule.hostPattern().matcher("192.168.1.1").matches());
+        assertFalse(rule.hostPattern().matcher("10.0.0.1").matches());
+    }
+
+    @Test
+    public void testAclRuleWithEmptyHost() {
+        Properties props = new Properties();
+        props.setProperty(ClusterMirrorConfig.ACLS_INCLUDE_CONFIG, 
"TOPIC;.*;;;;;READ;ALLOW;User:alice");
+
+        ClusterMirrorConfig config = ClusterMirrorConfig.fromProperties(props);
+
+        assertEquals(1, config.aclIncludeRules().size());
+        ClusterMirrorConfig.MirrorAclRule rule = 
config.aclIncludeRules().get(0);
+        assertNull(rule.hostPattern());

Review Comment:
   Good catch!



##########
mirror-coordinator/src/main/java/org/apache/kafka/coordinator/mirror/ClusterMirrorConfig.java:
##########
@@ -0,0 +1,532 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.mirror;
+
+import org.apache.kafka.clients.CommonClientConfigs;
+import org.apache.kafka.common.acl.AclBinding;
+import org.apache.kafka.common.acl.AclOperation;
+import org.apache.kafka.common.acl.AclPermissionType;
+import org.apache.kafka.common.config.AbstractConfig;
+import org.apache.kafka.common.config.ConfigDef;
+import org.apache.kafka.common.config.ConfigException;
+import org.apache.kafka.common.config.SaslConfigs;
+import org.apache.kafka.common.config.SecurityConfig;
+import org.apache.kafka.common.config.SslConfigs;
+import org.apache.kafka.common.resource.ResourceType;
+import org.apache.kafka.common.security.auth.SecurityProtocol;
+import org.apache.kafka.common.utils.Utils;
+
+import com.google.re2j.Pattern;
+import com.google.re2j.PatternSyntaxException;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+import java.util.Properties;
+
+import static org.apache.kafka.common.config.ConfigDef.Importance.HIGH;
+import static org.apache.kafka.common.config.ConfigDef.Importance.LOW;
+import static org.apache.kafka.common.config.ConfigDef.Importance.MEDIUM;
+import static org.apache.kafka.common.config.ConfigDef.Range.atLeast;
+import static org.apache.kafka.common.config.ConfigDef.Type.INT;
+import static org.apache.kafka.common.config.ConfigDef.Type.LIST;
+import static org.apache.kafka.common.config.ConfigDef.Type.LONG;
+import static org.apache.kafka.common.config.ConfigDef.Type.STRING;
+import static org.apache.kafka.server.util.MirrorUtils.compilePattern;
+import static org.apache.kafka.server.util.MirrorUtils.compilePatternList;
+
+/**
+ * Cluster Mirror configurations.
+ * Set when creating/altering a specific mirror.
+ * Stored in cluster metadata.
+ */
+public final class ClusterMirrorConfig extends AbstractConfig {
+    public static final String BOOTSTRAP_SERVERS_CONFIG = 
CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG;
+    private static final String BOOTSTRAP_SERVERS_DOC = "A list of host/port 
pairs to use for establishing the initial connection to the source cluster. " +
+            "This is a required configuration when creating a cluster mirror.";
+
+    public static final String SOURCE_CLUSTER_ID_CONFIG = 
CommonClientConfigs.SOURCE_CLUSTER_ID_CONFIG;
+    private static final String SOURCE_CLUSTER_ID_DOC = 
CommonClientConfigs.SOURCE_CLUSTER_ID_DOC;
+
+    public static final String REQUEST_TIMEOUT_MS_CONFIG = 
CommonClientConfigs.REQUEST_TIMEOUT_MS_CONFIG;
+    private static final String REQUEST_TIMEOUT_MS_DOC = 
CommonClientConfigs.REQUEST_TIMEOUT_MS_DOC;
+    private static final int REQUEST_TIMEOUT_MS_DEFAULT = 30 * 1000;
+
+    public static final String CONNECTION_SETUP_TIMEOUT_MS_CONFIG = 
CommonClientConfigs.SOCKET_CONNECTION_SETUP_TIMEOUT_MS_CONFIG;
+    private static final String CONNECTION_SETUP_TIMEOUT_MS_DOC = 
CommonClientConfigs.SOCKET_CONNECTION_SETUP_TIMEOUT_MS_DOC;
+    private static final long CONNECTION_SETUP_TIMEOUT_MS_DEFAULT = 
CommonClientConfigs.DEFAULT_SOCKET_CONNECTION_SETUP_TIMEOUT_MS;
+
+    public static final String CONNECTION_SETUP_TIMEOUT_MAX_MS_CONFIG = 
CommonClientConfigs.SOCKET_CONNECTION_SETUP_TIMEOUT_MAX_MS_CONFIG;
+    private static final String CONNECTION_SETUP_TIMEOUT_MAX_MS_DOC = 
CommonClientConfigs.SOCKET_CONNECTION_SETUP_TIMEOUT_MAX_MS_DOC;
+    private static final long CONNECTION_SETUP_TIMEOUT_MAX_MS_DEFAULT = 
CommonClientConfigs.DEFAULT_SOCKET_CONNECTION_SETUP_TIMEOUT_MAX_MS;
+
+    public static final String CONNECTIONS_MAX_IDLE_MS_CONFIG = 
CommonClientConfigs.CONNECTIONS_MAX_IDLE_MS_CONFIG;
+    private static final String CONNECTIONS_MAX_IDLE_MS_DOC = 
CommonClientConfigs.CONNECTIONS_MAX_IDLE_MS_DOC;
+    private static final long CONNECTIONS_MAX_IDLE_MS_DEFAULT = 10 * 60 * 
1000L;
+
+    public static final String SOCKET_TIMEOUT_MS_CONFIG = "socket.timeout.ms";
+    private static final String SOCKET_TIMEOUT_MS_DOC = "The socket timeout 
for network requests.";
+    private static final int SOCKET_TIMEOUT_MS_DEFAULT = 30 * 1000;
+
+    public static final String SOCKET_RECEIVE_BUFFER_BYTES_CONFIG = 
"socket.receive.buffer.bytes";
+    private static final String SOCKET_RECEIVE_BUFFER_BYTES_DOC = "The socket 
receive buffer for network requests to the source cluster.";
+    private static final int SOCKET_RECEIVE_BUFFER_BYTES_DEFAULT = 64 * 1024;
+
+    public static final String FETCH_WAIT_MAX_MS_CONFIG = "fetch.wait.max.ms";
+    private static final String FETCH_WAIT_MAX_MS_DOC = "The maximum wait time 
for each fetcher request issued by mirror replicas.";
+    private static final int FETCH_WAIT_MAX_MS_DEFAULT = 1000;
+
+    public static final String FETCH_BACKOFF_MS_CONFIG = "fetch.backoff.ms";
+    private static final String FETCH_BACKOFF_MS_DOC = "The amount of time to 
wait before retrying mirror fetch requests after a failure. " +
+            "This controls the backoff for mirror fetcher threads on 
connection errors or other exceptions from the source cluster.";
+    private static final long FETCH_BACKOFF_MS_DEFAULT = 1000;
+
+    public static final String FETCH_MIN_BYTES_CONFIG = "fetch.min.bytes";
+    private static final String FETCH_MIN_BYTES_DOC = "Minimum bytes expected 
for each fetch response.";
+    private static final int FETCH_MIN_BYTES_DEFAULT = 1;
+
+    public static final String FETCH_RESPONSE_MAX_BYTES_CONFIG = 
"fetch.response.max.bytes";
+    private static final String FETCH_RESPONSE_MAX_BYTES_DOC = "Maximum bytes 
expected for the entire fetch response. Records are fetched in batches, " +
+            "and if the first record batch in the first non-empty partition is 
larger than this value, the record batch will still be returned.";
+    private static final int FETCH_RESPONSE_MAX_BYTES_DEFAULT = 10 * 1024 * 
1024;
+
+    public static final String FETCH_MAX_BYTES_CONFIG = "fetch.max.bytes";
+    private static final String FETCH_MAX_BYTES_DOC = "The number of bytes of 
messages to attempt to fetch for each partition.";
+    private static final int FETCH_MAX_BYTES_DEFAULT = 1024 * 1024;
+
+    public static final String TOPIC_PROPERTIES_EXCLUDE_CONFIG = 
"topic.properties.exclude";
+    private static final String TOPIC_PROPERTIES_EXCLUDE_DOC = "A 
comma-separated list of topic config property names and/or regexes to exclude 
from synchronization. "
+            + "Properties in this list will not be replicated from the source 
cluster.";
+    // The message.timestamp.difference.max.ms property was removed in 4.0 but 
may still be used by older clusters
+    private static final String TOPIC_PROPERTIES_EXCLUDE_DEFAULT =
+            "follower.replication.throttled.replicas,"
+                    + "leader.replication.throttled.replicas,"
+                    + "message.timestamp.difference.max.ms,"
+                    + "message.timestamp.before.max.ms,"
+                    + "message.timestamp.after.max.ms,"
+                    + "message.timestamp.type,"
+                    + "unclean.leader.election.enable,"
+                    + "min.insync.replicas,"
+                    + "mirror.replication.throttled.replicas,"
+                    + "mirror.unclean.leader.election.enable";
+
+    public static final String TOPICS_INCLUDE_CONFIG = "topics.include";
+    private static final String TOPICS_INCLUDE_DOC = "A comma-separated list 
of regex patterns for topic names to include in mirroring. "
+            + "Topics on the source cluster whose names match at least one of 
the patterns will be automatically discovered and mirrored.";
+    private static final String TOPICS_INCLUDE_DEFAULT = ".*";
+
+    public static final String TOPICS_EXCLUDE_CONFIG = "topics.exclude";
+    private static final String TOPICS_EXCLUDE_DOC = "A comma-separated list 
of regex patterns for topic names to exclude from mirroring. "
+            + "Internal topics are excluded by default. Exclusions take 
precedence over inclusions.";
+    private static final String TOPICS_EXCLUDE_DEFAULT = "__.*";
+
+    public static final String GROUPS_INCLUDE_CONFIG = "groups.include";
+    private static final String GROUPS_INCLUDE_DOC = "A comma-separated list 
of regex patterns for consumer group IDs to include in offset synchronization. "
+            + "Only consumer groups whose IDs match at least one of the 
patterns will have their offsets replicated from the source cluster.";
+    private static final String GROUPS_INCLUDE_DEFAULT = ".*";
+
+    public static final String GROUPS_EXCLUDE_CONFIG = "groups.exclude";
+    private static final String GROUPS_EXCLUDE_DOC = "A comma-separated list 
of regex patterns for consumer group IDs to exclude from offset 
synchronization. " +
+            "Exclusions take precedence over inclusions.";
+    private static final String GROUPS_EXCLUDE_DEFAULT = "";
+
+    public static final String ACLS_INCLUDE_CONFIG = "acls.include";
+    private static final String ACLS_INCLUDE_DOC = "ACL include rules. " + 
MirrorAclRule.DOC
+            + "Examples: .* (match all ACLs), TOPIC;orders.* (all ACLs for 
topics matching orders.*), "
+            + "TOPIC;.*;READ;ALLOW||TOPIC;.*;WRITE;ALLOW (all topic READ and 
WRITE ALLOW ACLs), "
+            + "ANY;.*;ANY;ANY;User:alice (all ACLs for principal User:alice).";
+    private static final String ACLS_INCLUDE_DEFAULT = ".*";
+
+    public static final String ACLS_EXCLUDE_CONFIG = "acls.exclude";
+    private static final String ACLS_EXCLUDE_DOC = "ACL exclude rules. " + 
MirrorAclRule.DOC
+            + "Exclusions take precedence over inclusions. "
+            + "Examples: .* (exclude all ACLs), ANY;.*;WRITE (exclude all 
WRITE ACLs), "
+            + "ANY;.*;ANY;ANY;User:bob (exclude all ACLs for User:bob).";
+    private static final String ACLS_EXCLUDE_DEFAULT = "";
+
+    public static final String SECURITY_PROTOCOL_CONFIG = 
CommonClientConfigs.SECURITY_PROTOCOL_CONFIG;
+    private static final String SECURITY_PROTOCOL_DOC = 
CommonClientConfigs.SECURITY_PROTOCOL_DOC;
+    private static final String SECURITY_PROTOCOL_DEFAULT = 
SecurityProtocol.PLAINTEXT.name;
+
+    public static final String SECURITY_PROVIDERS_CONFIG = 
SecurityConfig.SECURITY_PROVIDERS_CONFIG;
+    private static final String SECURITY_PROVIDERS_DOC = 
SecurityConfig.SECURITY_PROVIDERS_DOC;
+
+    private static final ConfigDef.Validator 
SOCKET_RECEIVE_BUFFER_BYTES_VALIDATOR = ConfigDef.LambdaValidator.with(
+            (name, value) -> {
+                int size = (int) value;
+                if (size != -1 && size < 1) {
+                    throw new ConfigException(
+                            name,
+                            value,
+                            "Must be -1 or a positive integer."
+                    );
+                }
+            },
+            () -> "Must be -1 or a positive integer"
+    );
+
+    @SuppressWarnings("unchecked")
+    private static final ConfigDef.Validator REGEX_LIST_VALIDATOR = 
ConfigDef.LambdaValidator.with(
+            (name, value) -> {
+                if (value == null) return;
+                List<String> patterns = (List<String>) value;
+                for (String pattern : patterns) {
+                    String trimmed = pattern.trim();
+                    if (!trimmed.isEmpty()) {
+                        try {
+                            Pattern.compile(trimmed);
+                        } catch (PatternSyntaxException e) {
+                            throw new ConfigException(name, value, "Invalid 
regex pattern: " + e.getMessage());
+                        }
+                    }
+                }
+            },
+            () -> "Valid comma-separated list of regex patterns"
+    );
+
+    private static final ConfigDef.Validator ACL_RULES_VALIDATOR = 
ConfigDef.LambdaValidator.with(
+            (name, value) -> {
+                if (value == null) return;
+                String rules = (String) value;
+                try {
+                    MirrorAclRule.parseList(rules);
+                } catch (Exception e) {
+                    throw new ConfigException(name, value, "Invalid ACL rule: 
" + e.getMessage());
+                }
+            },
+            () -> "Valid ACL rules separated by || with five 
semicolon-separated fields"

Review Comment:
   Good catch!



##########
clients/src/main/java/org/apache/kafka/clients/CommonClientConfigs.java:
##########
@@ -265,6 +265,9 @@ public class CommonClientConfigs {
             "metadata for this interval, client repeats the bootstrap process 
using <code>bootstrap.servers</code> configuration.";
     public static final long DEFAULT_METADATA_RECOVERY_REBOOTSTRAP_TRIGGER_MS 
= 300 * 1000;
 
+    public static final String SOURCE_CLUSTER_ID_CONFIG = "source.cluster.id";

Review Comment:
   Yes, we have a couple of new components depending in this.



-- 
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: [email protected]

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

Reply via email to