This is an automated email from the ASF dual-hosted git repository.
chengpan pushed a commit to branch branch-1.8
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/branch-1.8 by this push:
new 5744d898c [KYUUBI #5297] [CLIENT] New RetryableClient get http://null
server uri from metadata.kyuubiInstance
5744d898c is described below
commit 5744d898c56d9c78c621a500bba8d1278e79fe1c
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]>
(cherry picked from commit 60ebe7de61710af68a6c5242a7545385056419f1)
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)