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

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


The following commit(s) were added to refs/heads/master by this push:
     new 60ebe7de6 [KYUUBI #5297] [CLIENT] New RetryableClient  get http://null 
server uri from metadata.kyuubiInstance
60ebe7de6 is described below

commit 60ebe7de61710af68a6c5242a7545385056419f1
Author: zwangsheng <[email protected]>
AuthorDate: Fri Sep 15 12:31:16 2023 +0000

    [KYUUBI #5297] [CLIENT] New RetryableClient  get http://null server uri 
from metadata.kyuubiInstance
    
    ### _Why are the changes needed?_
    
    Due to #5078, we marked kyuubi_instance in metadata can be null.
    
    We should append kyuubi_instance after we check it's non-null.
    
    Otherwise we may face the following error when we use v2 submit job
    ```
    2023-09-14 19:05:43 [INFO] [main] 
org.apache.kyuubi.client.RetryableRestClient#74 - Current connect server uri 
http://null/api/v1
    2023-09-14 19:05:43 [ERROR] [main] org.apache.kyuubi.client.RestClient#189 
- Error:
    java.net.UnknownHostException: null: Name or service not known
    ```
    
    ### _How was this patch tested?_
    - [ ] 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.readthedocs.io/en/master/contributing/code/testing.html#running-tests)
 locally before make a pull request
    
    ### _Was this patch authored or co-authored using generative AI tooling?_
    
    No
    
    Closes #5297 from zwangsheng/client/resetclient_get_null.
    
    Closes #5297
    
    2b4b56020 [zwangsheng] [CLIENT] Get null from metadata.kyuubiInstance
    
    Authored-by: zwangsheng <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
---
 .../src/main/scala/org/apache/kyuubi/ctl/RestClientFactory.scala       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/RestClientFactory.scala 
b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/RestClientFactory.scala
index 75b490a4a..d971eec13 100644
--- a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/RestClientFactory.scala
+++ b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/RestClientFactory.scala
@@ -47,7 +47,8 @@ object RestClientFactory {
       kyuubiRestClient: KyuubiRestClient,
       kyuubiInstance: String)(f: KyuubiRestClient => Unit): Unit = {
     val kyuubiInstanceRestClient = kyuubiRestClient.clone()
-    val hostUrls = Seq(s"http://$kyuubiInstance";) ++ 
kyuubiRestClient.getHostUrls.asScala
+    val hostUrls = Option(kyuubiInstance).map(instance => 
s"http://$instance";).toSeq ++
+      kyuubiRestClient.getHostUrls.asScala
     kyuubiInstanceRestClient.setHostUrls(hostUrls.asJava)
     try {
       f(kyuubiInstanceRestClient)

Reply via email to