[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 <binjieyang@apache.org> Signed-off-by: Cheng Pan <chengpan@apache.org>
This commit is contained in:
parent
7ba458a0da
commit
60ebe7de61
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user