You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ch...@apache.org on 2022/12/22 03:36:59 UTC

[incubator-kyuubi] branch branch-1.6 updated: [KYUUBI #3973] Fix a conf fallback for `kyuubi-ctl list server` when kyuubi-defaults.conf use deprecated zk key

This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch branch-1.6
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git


The following commit(s) were added to refs/heads/branch-1.6 by this push:
     new 029ba905d [KYUUBI #3973] Fix a conf fallback for `kyuubi-ctl list server` when kyuubi-defaults.conf use deprecated zk key
029ba905d is described below

commit 029ba905dc556eb2fc54ce2fe1215f96bae22d84
Author: John Caveman <se...@gmail.com>
AuthorDate: Thu Dec 22 11:36:37 2022 +0800

    [KYUUBI #3973] Fix a conf fallback for `kyuubi-ctl list server` when kyuubi-defaults.conf use deprecated zk key
    
    ### _Why are the changes needed?_
    
    To fix https://github.com/apache/incubator-kyuubi/issues/3973, we found similar problem during upgrade from 1.5 to 1.6
    
    ### _How was this patch tested?_
    Manual test on internal cluster, UT will be added later on
    
    - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #3997 from CavemanIV/kyuubi-3973.
    
    Closes #3973
    
    7dae77cf [John Caveman] fix validation for ut
    96adf586 [John Caveman] use conf.get
    0b0df721 [John Caveman] style fix
    f0f167fb [John Caveman] replace for-conf-key-lambda to option chain for a more consistent coding style
    6a308d5c [John Caveman] revert ut, command only read conf from kyuubi-defaults directly
    ff999221 [John Caveman] fix kyuubi-ctl list fall back to HA_ZK_QUORUM in kyuubi-default.conf when HA_ADDRESSES is not set
    
    Authored-by: John Caveman <se...@gmail.com>
    Signed-off-by: Cheng Pan <ch...@apache.org>
    (cherry picked from commit 4d6942cb2b5ef68c3026b4e6f875f8ab1b174d0e)
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 .../src/main/scala/org/apache/kyuubi/ctl/cmd/Command.scala       | 9 ++++-----
 .../src/main/scala/org/apache/kyuubi/ctl/util/Validator.scala    | 2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/Command.scala b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/Command.scala
index 6dd88e5e7..73c96ee61 100644
--- a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/Command.scala
+++ b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/Command.scala
@@ -57,11 +57,10 @@ abstract class Command[T](cliConfig: CliConfig) extends Logging {
   private def useDefaultPropertyValueIfMissing(): CliConfig = {
     var arguments: CliConfig = cliConfig.copy()
     if (cliConfig.zkOpts.zkQuorum == null) {
-      conf.getOption(HA_ADDRESSES.key).foreach { v =>
-        if (verbose) {
-          super.info(s"Zookeeper quorum is not specified, use value from default conf:$v")
-        }
-        arguments = arguments.copy(zkOpts = arguments.zkOpts.copy(zkQuorum = v))
+      val quorum = conf.get(HA_ADDRESSES)
+      arguments = arguments.copy(zkOpts = arguments.zkOpts.copy(zkQuorum = quorum))
+      if (verbose) {
+        super.info(s"Zookeeper quorum is not specified, use value from default conf: $quorum")
       }
     }
 
diff --git a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/util/Validator.scala b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/util/Validator.scala
index 05df08c1e..7f6b17417 100644
--- a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/util/Validator.scala
+++ b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/util/Validator.scala
@@ -27,7 +27,7 @@ import org.apache.kyuubi.ctl.CliConfig
 private[ctl] object Validator {
 
   def validateZkArguments(cliConfig: CliConfig): Unit = {
-    if (cliConfig.zkOpts.zkQuorum == null) {
+    if (cliConfig.zkOpts.zkQuorum == null || cliConfig.zkOpts.zkQuorum.isEmpty) {
       fail("Zookeeper quorum is not specified and no default value to load")
     }
     if (cliConfig.zkOpts.namespace == null) {