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


##########
mirror-coordinator/src/main/java/org/apache/kafka/coordinator/mirror/ClusterMirrorConfig.java:
##########
@@ -0,0 +1,705 @@
+/*
+ * 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.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 com.google.re2j.Pattern;
+
+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.Range.between;
+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.PASSWORD;
+import static org.apache.kafka.common.config.ConfigDef.Type.SHORT;
+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;
+
+/**
+ * This class provides proper validation, defaults, and documentation
+ * for all configurations supported by the Cluster Mirroring feature.
+ */
+public final class ClusterMirrorConfig extends AbstractConfig {
+    // ---------------------------------------------------------------
+    // Broker level configs. Set when starting/rebooting the broker. Stored in 
server.properties or dynamic broker config.
+    // ---------------------------------------------------------------
+
+    public static final String MIRROR_COORDINATOR_THREADS_CONFIG = 
"mirror.coordinator.threads";
+    private static final String MIRROR_COORDINATOR_THREADS_DOC = "The number 
of threads used to process coordinator events for cluster mirroring.";
+    private static final int MIRROR_COORDINATOR_THREADS_DEFAULT = 1;
+
+    public static final String MIRROR_COORDINATOR_WRITE_TIMEOUT_MS_CONFIG = 
"mirror.coordinator.write.timeout.ms";
+    private static final String MIRROR_COORDINATOR_WRITE_TIMEOUT_MS_DOC = "The 
timeout in milliseconds for write operations on the mirror state coordinator.";
+    private static final long MIRROR_COORDINATOR_WRITE_TIMEOUT_MS_DEFAULT = 
5000L;
+
+    public static final String MIRROR_COORDINATOR_APPEND_LINGER_MS_CONFIG = 
"mirror.coordinator.append.linger.ms";
+    private static final String MIRROR_COORDINATOR_APPEND_LINGER_MS_DOC = "The 
linger time in milliseconds for batching records before flushing to the mirror 
state topic.";
+    private static final int MIRROR_COORDINATOR_APPEND_LINGER_MS_DEFAULT = 10;
+
+    public static final String MIRROR_COORDINATOR_LOAD_BUFFER_SIZE_CONFIG = 
"mirror.coordinator.load.buffer.size";
+    private static final String MIRROR_COORDINATOR_LOAD_BUFFER_SIZE_DOC = "The 
buffer size in bytes for loading mirror state records during coordinator 
startup.";
+    private static final int MIRROR_COORDINATOR_LOAD_BUFFER_SIZE_DEFAULT = 5 * 
1024 * 1024;
+
+    public static final String MIRROR_STATE_TOPIC_NUM_PARTITIONS_CONFIG = 
"mirror.state.topic.num.partitions";
+    private static final String MIRROR_STATE_TOPIC_NUM_PARTITIONS_DOC = "The 
number of partitions for the internal topic (should not change after 
deployment).";
+    private static final int MIRROR_STATE_TOPIC_NUM_PARTITIONS_DEFAULT = 50;
+
+    public static final String MIRROR_STATE_TOPIC_REPLICATION_FACTOR_CONFIG = 
"mirror.state.topic.replication.factor";
+    private static final String MIRROR_STATE_TOPIC_REPLICATION_FACTOR_DOC = 
"The replication factor for the internal topic. " +
+            "Topic creation will fail until the cluster size meets this 
replication factor requirement.";
+    private static final short MIRROR_STATE_TOPIC_REPLICATION_FACTOR_DEFAULT = 
3;
+
+    public static final String MIRROR_NUM_REPLICA_FETCHERS_CONFIG = 
"mirror.num.replica.fetchers";
+    private static final String MIRROR_NUM_REPLICA_FETCHERS_DOC = "Number of 
fetcher threads used to replicate records from each source broker in a cluster 
mirror. " +
+            "The total number of mirror fetcher threads on a broker equals 
this value multiplied by the number of distinct source brokers and the number 
of cluster mirrors. " +
+            "A higher value increases I/O parallelism for cross cluster 
replication at the cost of higher CPU and memory utilization.";
+    private static final int MIRROR_NUM_REPLICA_FETCHERS_DEFAULT = 1;
+
+    public static final String MIRROR_METADATA_REFRESH_INTERVAL_MS_CONFIG = 
"mirror.metadata.refresh.interval.ms";
+    private static final String MIRROR_METADATA_REFRESH_INTERVAL_MS_DOC = "The 
interval in milliseconds at which the coordinator refreshes metadata from 
source clusters. " +
+            "This controls how frequently the coordinator polls source 
clusters to detect new topics and metadata changes.";
+    private static final long MIRROR_METADATA_REFRESH_INTERVAL_MS_DEFAULT = 
60000L;
+
+    public static final String MIRROR_FAILED_RETRY_INITIAL_BACKOFF_MS_CONFIG = 
"mirror.failed.retry.initial.backoff.ms";
+    private static final String MIRROR_FAILED_RETRY_INITIAL_BACKOFF_MS_DOC = 
"The initial backoff time in milliseconds before retrying a mirror partition " +
+            "in FAILED state. The actual delay uses full jitter: a uniform 
random value in [0, backoff].";
+    private static final long MIRROR_FAILED_RETRY_INITIAL_BACKOFF_MS_DEFAULT = 
100L;
+
+    public static final String MIRROR_FAILED_RETRY_MAX_BACKOFF_MS_CONFIG = 
"mirror.failed.retry.max.backoff.ms";
+    private static final String MIRROR_FAILED_RETRY_MAX_BACKOFF_MS_DOC = "The 
maximum backoff time in milliseconds for retrying a mirror partition in FAILED 
state.";
+    private static final long MIRROR_FAILED_RETRY_MAX_BACKOFF_MS_DEFAULT = 
300000L;
+
+    public static final String MIRROR_FAILED_RETRY_MAX_ATTEMPTS_CONFIG = 
"mirror.failed.retry.max.attempts";
+    private static final String MIRROR_FAILED_RETRY_MAX_ATTEMPTS_DOC = "The 
maximum number of automatic retry attempts for a mirror partition in FAILED 
state. " +
+            "After this limit is reached, manual intervention is required via 
the start-mirror-topics command. " +
+            "Set to 0 to disable automatic retries.";
+    private static final int MIRROR_FAILED_RETRY_MAX_ATTEMPTS_DEFAULT = 20;
+
+    // ---------------------------------------------------------------
+    // Mirror level configs. Set when creating/altering a specific mirror. 
Stored in cluster metadata.
+    // ---------------------------------------------------------------
+
+    // Connection configuration
+    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 = 
"connections.max.idle.ms";

Review Comment:
   BTW the mirror config in the KIP didn't mention these connection configs. 
Need to update the KIP to be in line with code



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