This is an automated email from the ASF dual-hosted git repository.
jinsongzhou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git
The following commit(s) were added to refs/heads/master by this push:
new 931d0c2d4 [AMORO-3624]: In HA mode, the zk client session timeout and
connection timeout should be configurable. #3624 (#3625)
931d0c2d4 is described below
commit 931d0c2d4f50ab9f3c13dd0348b24e3e86d911e4
Author: can <[email protected]>
AuthorDate: Tue Jun 24 14:39:33 2025 +0800
[AMORO-3624]: In HA mode, the zk client session timeout and connection
timeout should be configurable. #3624 (#3625)
* [Improvement]: In HA mode, the zk client session timeout and connection
timeout should be configurable. #3624
* [Improvement]: In HA mode, the zk client session timeout and connection
timeout should be configurable. #3624
---------
Co-authored-by: wardli <[email protected]>
---
.../java/org/apache/amoro/server/AmoroManagementConf.java | 12 ++++++++++++
.../org/apache/amoro/server/HighAvailabilityContainer.java | 8 ++++++--
dist/src/main/amoro-bin/conf/config.yaml | 7 +++++++
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git
a/amoro-ams/src/main/java/org/apache/amoro/server/AmoroManagementConf.java
b/amoro-ams/src/main/java/org/apache/amoro/server/AmoroManagementConf.java
index 6103c30d8..5bb9d1cdd 100644
--- a/amoro-ams/src/main/java/org/apache/amoro/server/AmoroManagementConf.java
+++ b/amoro-ams/src/main/java/org/apache/amoro/server/AmoroManagementConf.java
@@ -215,6 +215,18 @@ public class AmoroManagementConf {
.defaultValue("")
.withDescription("The Zookeeper address used for high
availability.");
+ public static final ConfigOption<Duration> HA_ZOOKEEPER_SESSION_TIMEOUT =
+ ConfigOptions.key("ha.session-timeout")
+ .durationType()
+ .defaultValue(Duration.ofSeconds(30))
+ .withDescription("The Zookeeper session timeout in milliseconds.");
+
+ public static final ConfigOption<Duration> HA_ZOOKEEPER_CONNECTION_TIMEOUT =
+ ConfigOptions.key("ha.connection-timeout")
+ .durationType()
+ .defaultValue(Duration.ofSeconds(300))
+ .withDescription("The Zookeeper connection timeout in
milliseconds.");
+
public static final ConfigOption<Integer> TABLE_SERVICE_THRIFT_BIND_PORT =
ConfigOptions.key("thrift-server.table-service.bind-port")
.intType()
diff --git
a/amoro-ams/src/main/java/org/apache/amoro/server/HighAvailabilityContainer.java
b/amoro-ams/src/main/java/org/apache/amoro/server/HighAvailabilityContainer.java
index 8b6d323cd..97ed08c7b 100644
---
a/amoro-ams/src/main/java/org/apache/amoro/server/HighAvailabilityContainer.java
+++
b/amoro-ams/src/main/java/org/apache/amoro/server/HighAvailabilityContainer.java
@@ -51,6 +51,10 @@ public class HighAvailabilityContainer implements
LeaderLatchListener {
public HighAvailabilityContainer(Configurations serviceConfig) throws
Exception {
if (serviceConfig.getBoolean(AmoroManagementConf.HA_ENABLE)) {
String zkServerAddress =
serviceConfig.getString(AmoroManagementConf.HA_ZOOKEEPER_ADDRESS);
+ int zkSessionTimeout =
+ (int)
serviceConfig.get(AmoroManagementConf.HA_ZOOKEEPER_SESSION_TIMEOUT).toMillis();
+ int zkConnectionTimeout =
+ (int)
serviceConfig.get(AmoroManagementConf.HA_ZOOKEEPER_CONNECTION_TIMEOUT).toMillis();
String haClusterName =
serviceConfig.getString(AmoroManagementConf.HA_CLUSTER_NAME);
tableServiceMasterPath =
AmsHAProperties.getTableServiceMasterPath(haClusterName);
optimizingServiceMasterPath =
AmsHAProperties.getOptimizingServiceMasterPath(haClusterName);
@@ -58,8 +62,8 @@ public class HighAvailabilityContainer implements
LeaderLatchListener {
this.zkClient =
CuratorFrameworkFactory.builder()
.connectString(zkServerAddress)
- .sessionTimeoutMs(5000)
- .connectionTimeoutMs(5000)
+ .sessionTimeoutMs(zkSessionTimeout)
+ .connectionTimeoutMs(zkConnectionTimeout)
.retryPolicy(retryPolicy)
.build();
zkClient.start();
diff --git a/dist/src/main/amoro-bin/conf/config.yaml
b/dist/src/main/amoro-bin/conf/config.yaml
index b51aa985f..d66f2a347 100644
--- a/dist/src/main/amoro-bin/conf/config.yaml
+++ b/dist/src/main/amoro-bin/conf/config.yaml
@@ -112,6 +112,13 @@ ams:
connection-pool-max-idle: 16
connection-pool-max-wait-millis: 30000
+# ha:
+# enabled: true
+# cluster-name: xxx
+# zookeeper-address: xxx.xxx.xxx.xxx:2181
+# session-timeout: 30s
+# connection-timeout: 30s
+
# MySQL database configuration.
# database:
# type: mysql