Skip to content

Commit

Permalink
[KYUUBI #5297] [CLIENT] New RetryableClient get http://null server ur…
Browse files Browse the repository at this point in the history
…i 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

2b4b560 [zwangsheng] [CLIENT] Get null from metadata.kyuubiInstance

Authored-by: zwangsheng <[email protected]>
Signed-off-by: Cheng Pan <[email protected]>
  • Loading branch information
zwangsheng authored and pan3793 committed Sep 15, 2023
1 parent 7ba458a commit 60ebe7d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 60ebe7d

Please sign in to comment.