From 9e81a6a34ced30925eae774f24aba6bd8f225d12 Mon Sep 17 00:00:00 2001 From: hongdongdong Date: Thu, 2 Jun 2022 09:58:57 +0800 Subject: [PATCH] Rename HA_ZK_ENGINE_REF_ID to HA_ENGINE_REF_ID --- .../scala/org/apache/kyuubi/ha/HighAvailabilityConf.scala | 2 +- .../apache/kyuubi/ha/client/etcd/EtcdDiscoveryClient.scala | 4 ++-- .../kyuubi/ha/client/zookeeper/ZookeeperACLProvider.scala | 4 ++-- .../kyuubi/ha/client/zookeeper/ZookeeperClientProvider.scala | 4 ++-- .../kyuubi/ha/client/zookeeper/ZookeeperDiscoveryClient.scala | 4 ++-- .../ha/client/zookeeper/ZookeeperDiscoveryClientSuite.scala | 4 ++-- .../src/main/scala/org/apache/kyuubi/engine/EngineRef.scala | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) 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 b6321ce30b9..f38a45ce6b3 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 @@ -155,7 +155,7 @@ object HighAvailabilityConf { .checkValue(_ > 0, "Must be positive") .createWithDefault(Duration.ofSeconds(120).toMillis) - val HA_ZK_ENGINE_REF_ID: OptionalConfigEntry[String] = + val HA_ENGINE_REF_ID: OptionalConfigEntry[String] = buildConf("kyuubi.ha.engine.ref.id") .doc("The engine reference id will be attached to zookeeper node when engine started, " + "and the kyuubi server will check it cyclically.") diff --git a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/etcd/EtcdDiscoveryClient.scala b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/etcd/EtcdDiscoveryClient.scala index 6dc58c68cee..dffd8f872b0 100644 --- a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/etcd/EtcdDiscoveryClient.scala +++ b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/etcd/EtcdDiscoveryClient.scala @@ -43,7 +43,7 @@ import org.apache.kyuubi.KyuubiSQLException import org.apache.kyuubi.config.KyuubiConf import org.apache.kyuubi.config.KyuubiConf.ENGINE_INIT_TIMEOUT import org.apache.kyuubi.ha.HighAvailabilityConf -import org.apache.kyuubi.ha.HighAvailabilityConf.HA_ZK_ENGINE_REF_ID +import org.apache.kyuubi.ha.HighAvailabilityConf.HA_ENGINE_REF_ID import org.apache.kyuubi.ha.client.DiscoveryClient import org.apache.kyuubi.ha.client.DiscoveryPaths import org.apache.kyuubi.ha.client.ServiceDiscovery @@ -268,7 +268,7 @@ class EtcdDiscoveryClient(conf: KyuubiConf) extends DiscoveryClient { val ns = DiscoveryPaths.makePath(null, namespace) create(ns, "PERSISTENT") - val session = conf.get(HA_ZK_ENGINE_REF_ID) + val session = conf.get(HA_ENGINE_REF_ID) .map(refId => s"refId=$refId;").getOrElse("") val pathPrefix = DiscoveryPaths.makePath( namespace, diff --git a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperACLProvider.scala b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperACLProvider.scala index 40ead463304..467c323b77e 100644 --- a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperACLProvider.scala +++ b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperACLProvider.scala @@ -42,9 +42,9 @@ class ZookeeperACLProvider(conf: KyuubiConf) extends ACLProvider { nodeAcls.addAll(ZooDefs.Ids.CREATOR_ALL_ACL) } - if (conf.get(HighAvailabilityConf.HA_ZK_ENGINE_REF_ID).isEmpty && enabledServerAcls()) { + if (conf.get(HighAvailabilityConf.HA_ENGINE_REF_ID).isEmpty && enabledServerAcls()) { addACL() - } else if (conf.get(HighAvailabilityConf.HA_ZK_ENGINE_REF_ID).nonEmpty && enabledEngineAcls()) { + } else if (conf.get(HighAvailabilityConf.HA_ENGINE_REF_ID).nonEmpty && enabledEngineAcls()) { addACL() } else { // ACLs for znodes on a non-kerberized cluster diff --git a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperClientProvider.scala b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperClientProvider.scala index 5ea121e7961..0cfc3af4a1b 100644 --- a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperClientProvider.scala +++ b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperClientProvider.scala @@ -119,10 +119,10 @@ object ZookeeperClientProvider extends Logging { } } - if (conf.get(HA_ZK_ENGINE_REF_ID).isEmpty + if (conf.get(HA_ENGINE_REF_ID).isEmpty && AuthTypes.withName(conf.get(HA_ZK_AUTH_TYPE)) == AuthTypes.KERBEROS) { setupZkAuth() - } else if (conf.get(HA_ZK_ENGINE_REF_ID).nonEmpty && AuthTypes + } else if (conf.get(HA_ENGINE_REF_ID).nonEmpty && AuthTypes .withName(conf.get(HA_ZK_ENGINE_AUTH_TYPE)) == AuthTypes.KERBEROS) { setupZkAuth() } diff --git a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperDiscoveryClient.scala b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperDiscoveryClient.scala index 830c806d6ff..e7a2bee0f61 100644 --- a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperDiscoveryClient.scala +++ b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperDiscoveryClient.scala @@ -46,7 +46,7 @@ import org.apache.kyuubi.KyuubiException import org.apache.kyuubi.KyuubiSQLException import org.apache.kyuubi.Logging import org.apache.kyuubi.config.KyuubiConf -import org.apache.kyuubi.ha.HighAvailabilityConf.HA_ZK_ENGINE_REF_ID +import org.apache.kyuubi.ha.HighAvailabilityConf.HA_ENGINE_REF_ID import org.apache.kyuubi.ha.HighAvailabilityConf.HA_ZK_NODE_TIMEOUT import org.apache.kyuubi.ha.HighAvailabilityConf.HA_ZK_PUBLISH_CONFIGS import org.apache.kyuubi.ha.client.DiscoveryClient @@ -344,7 +344,7 @@ class ZookeeperDiscoveryClient(conf: KyuubiConf) extends DiscoveryClient { throw new KyuubiException(s"Failed to create namespace '$ns'", e) } - val session = conf.get(HA_ZK_ENGINE_REF_ID) + val session = conf.get(HA_ENGINE_REF_ID) .map(refId => s"refId=$refId;").getOrElse("") val pathPrefix = ZKPaths.makePath( namespace, diff --git a/kyuubi-ha/src/test/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperDiscoveryClientSuite.scala b/kyuubi-ha/src/test/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperDiscoveryClientSuite.scala index 618708460b1..8b87d4aaddb 100644 --- a/kyuubi-ha/src/test/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperDiscoveryClientSuite.scala +++ b/kyuubi-ha/src/test/scala/org/apache/kyuubi/ha/client/zookeeper/ZookeeperDiscoveryClientSuite.scala @@ -78,12 +78,12 @@ class ZookeeperDiscoveryClientSuite extends DiscoveryClientTests with Kerberized val serverACL = new ZookeeperACLProvider(serverConf).getDefaultAcl assertACL(expectedEnableACL, serverACL) - val engineConf = serverConf.clone.set(HA_ZK_ENGINE_REF_ID, "ref") + val engineConf = serverConf.clone.set(HA_ENGINE_REF_ID, "ref") engineConf.set(HA_ZK_ENGINE_AUTH_TYPE, AuthTypes.NONE.toString) val engineACL = new ZookeeperACLProvider(engineConf).getDefaultAcl assertACL(expectedNoACL, engineACL) - val enableEngineACLConf = serverConf.clone.set(HA_ZK_ENGINE_REF_ID, "ref") + val enableEngineACLConf = serverConf.clone.set(HA_ENGINE_REF_ID, "ref") enableEngineACLConf.set(HA_ZK_ENGINE_AUTH_TYPE, AuthTypes.KERBEROS.toString) val enableEngineACL = new ZookeeperACLProvider(enableEngineACLConf).getDefaultAcl assertACL(expectedEnableACL, enableEngineACL) diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/EngineRef.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/EngineRef.scala index 34acd5889b6..6cbd1ff94e7 100644 --- a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/EngineRef.scala +++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/EngineRef.scala @@ -35,7 +35,7 @@ import org.apache.kyuubi.engine.flink.FlinkProcessBuilder import org.apache.kyuubi.engine.hive.HiveProcessBuilder import org.apache.kyuubi.engine.spark.SparkProcessBuilder import org.apache.kyuubi.engine.trino.TrinoProcessBuilder -import org.apache.kyuubi.ha.HighAvailabilityConf.{HA_NAMESPACE, HA_ZK_ENGINE_REF_ID} +import org.apache.kyuubi.ha.HighAvailabilityConf.{HA_ENGINE_REF_ID, HA_NAMESPACE} import org.apache.kyuubi.ha.client.{DiscoveryClient, DiscoveryPaths} import org.apache.kyuubi.metrics.MetricsConstants.{ENGINE_FAIL, ENGINE_TIMEOUT, ENGINE_TOTAL} import org.apache.kyuubi.metrics.MetricsSystem @@ -167,7 +167,7 @@ private[kyuubi] class EngineRef( if (engineRef.nonEmpty) return engineRef.get conf.set(HA_NAMESPACE, engineSpace) - conf.set(HA_ZK_ENGINE_REF_ID, engineRefId) + conf.set(HA_ENGINE_REF_ID, engineRefId) val started = System.currentTimeMillis() conf.set(KYUUBI_ENGINE_SUBMIT_TIME_KEY, String.valueOf(started)) builder = engineType match {