diff --git a/docs/deployment/settings.md b/docs/deployment/settings.md
index 63d56364e..e0400f5d0 100644
--- a/docs/deployment/settings.md
+++ b/docs/deployment/settings.md
@@ -165,6 +165,7 @@ kyuubi\.ha\.zookeeper
\.connection\.max\.retry
\.wait|
EXPONENTIAL_BACKOFF
|The retry policy for connecting to the zookeeper ensemble, all candidates are:
- ONE_TIME
- N_TIME
- EXPONENTIAL_BACKOFF
- BOUNDED_EXPONENTIAL_BACKOFF
- UNTIL_ELAPSED
|string
|1.0.0
kyuubi\.ha\.zookeeper
\.connection\.timeout|15000
|The timeout(ms) of creating the connection to the zookeeper ensemble
|int
|1.0.0
kyuubi\.ha\.zookeeper
\.namespace|kyuubi
|The root directory for the service to deploy its instance uri. Additionally, it will creates a -[username] suffixed root directory for each application
|string
|1.0.0
+kyuubi\.ha\.zookeeper
\.node\.creation\.timeout|PT2M
|Timeout for creating zookeeper node
|duration
|1.2.0
kyuubi\.ha\.zookeeper
\.quorum||The connection string for the zookeeper ensemble
|string
|1.0.0
kyuubi\.ha\.zookeeper
\.session\.timeout|60000
|The timeout(ms) of a connected session to be idled
|int
|1.0.0
diff --git a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/HighAvailabilityConf.scala b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/HighAvailabilityConf.scala
index edf3e9bcb..94fd91678 100644
--- a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/HighAvailabilityConf.scala
+++ b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/HighAvailabilityConf.scala
@@ -17,6 +17,8 @@
package org.apache.kyuubi.ha
+import java.time.Duration
+
import org.apache.hadoop.security.UserGroupInformation
import org.apache.kyuubi.config.{ConfigBuilder, ConfigEntry, KyuubiConf}
@@ -90,4 +92,11 @@ object HighAvailabilityConf {
.checkValues(RetryPolicies.values.map(_.toString))
.createWithDefault(RetryPolicies.EXPONENTIAL_BACKOFF.toString)
+ val HA_ZK_NODE_TIMEOUT: ConfigEntry[Long] =
+ buildConf("ha.zookeeper.node.creation.timeout")
+ .doc("Timeout for creating zookeeper node")
+ .version("1.2.0")
+ .timeConf
+ .checkValue(_ > 0, "Must be positive")
+ .createWithDefault(Duration.ofSeconds(120).toMillis)
}
diff --git a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/ServiceDiscovery.scala b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/ServiceDiscovery.scala
index 52e5b4496..46fc6e59b 100644
--- a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/ServiceDiscovery.scala
+++ b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/ServiceDiscovery.scala
@@ -125,8 +125,8 @@ abstract class ServiceDiscovery private (
pathPrefix,
instance.getBytes(StandardCharsets.UTF_8))
serviceNode.start()
- val znodeTimeout = 120
- if (!serviceNode.waitForInitialCreate(znodeTimeout, TimeUnit.SECONDS)) {
+ val znodeTimeout = conf.get(HA_ZK_NODE_TIMEOUT)
+ if (!serviceNode.waitForInitialCreate(znodeTimeout, TimeUnit.MILLISECONDS)) {
throw new KyuubiException(s"Max znode creation wait time $znodeTimeout s exhausted")
}
info(s"Created a ${serviceNode.getActualPath} on ZooKeeper for KyuubiServer uri: " + instance)
diff --git a/kyuubi-ha/src/test/scala/org/apache/kyuubi/ha/client/HighAvailabilityConfSuite.scala b/kyuubi-ha/src/test/scala/org/apache/kyuubi/ha/client/HighAvailabilityConfSuite.scala
new file mode 100644
index 000000000..f5c7be840
--- /dev/null
+++ b/kyuubi-ha/src/test/scala/org/apache/kyuubi/ha/client/HighAvailabilityConfSuite.scala
@@ -0,0 +1,33 @@
+/*
+ * 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.kyuubi.ha.client
+
+import org.apache.kyuubi.KyuubiFunSuite
+import org.apache.kyuubi.config.KyuubiConf
+import org.apache.kyuubi.ha.HighAvailabilityConf._
+
+class HighAvailabilityConfSuite extends KyuubiFunSuite {
+ test(HA_ZK_NODE_TIMEOUT.key) {
+ val conf = new KyuubiConf()
+ assert(conf.get(HA_ZK_NODE_TIMEOUT) == HA_ZK_NODE_TIMEOUT.defaultVal.get)
+ conf.set(HA_ZK_NODE_TIMEOUT.key, "60000")
+ assert(conf.get(HA_ZK_NODE_TIMEOUT) == 60000)
+ conf.set(HA_ZK_NODE_TIMEOUT.key, "PT1M")
+ assert(conf.get(HA_ZK_NODE_TIMEOUT) == 60000)
+ }
+}