From 8785f857c5086f15d305f04ada532436dbfa67b6 Mon Sep 17 00:00:00 2001 From: Xiao Yu Date: Fri, 21 Feb 2025 20:55:06 +0000 Subject: [PATCH] Set Curator Connection Timeout Curator 5.2.0 has a default "connection timeout" of 15s: https://github.com/apache/curator/blob/apache-curator-5.2.0/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java#L63 And it will throw a warning if the Zookeeper session timeout is less than the Curator connection timeout: https://github.com/apache/curator/blob/apache-curator-5.2.0/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java#L117-L120 The Hadoop default for ZK timeout is set to 10s: https://github.com/apache/hadoop/blob/0dd9bf8/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeys.java#L414-L416 Which means without setting the "connection timeout" a default installation will keep warning about the connection timeout for Curator is lower than the requested session timeout. This sets both timeout values to override the Curator default. Another option is to change the default Hadoop ZK timeout from 10s to 15s. --- .../java/org/apache/hadoop/util/curator/ZKCuratorManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/curator/ZKCuratorManager.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/curator/ZKCuratorManager.java index 4f279fbfaf277..f574f10308a32 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/curator/ZKCuratorManager.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/curator/ZKCuratorManager.java @@ -207,6 +207,7 @@ public void start(List authInfos, boolean sslEnabled, String zkHostPor conf.get(CommonConfigurationKeys.ZK_KERBEROS_PRINCIPAL), conf.get(CommonConfigurationKeys.ZK_KERBEROS_KEYTAB), sslEnabled, new TruststoreKeystore(conf))).zkClientConfig(zkClientConfig) + .connectionTimeoutMs(zkSessionTimeout) .sessionTimeoutMs(zkSessionTimeout).retryPolicy(retryPolicy) .authorization(authInfos).build(); client.start(); @@ -618,4 +619,4 @@ private void setJaasConfiguration(ZKClientConfig zkClientConfig) throws IOExcept zkClientConfig.setProperty(ZKClientConfig.LOGIN_CONTEXT_NAME_KEY, JAAS_CLIENT_ENTRY); } } -} \ No newline at end of file +}