This is an automated email from the ASF dual-hosted git repository.
yao pushed a commit to branch branch-1.5
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git
The following commit(s) were added to refs/heads/branch-1.5 by this push:
new ed177fc [KYUUBI #2125] closeSession should avoid sending RPC after
openSession fails
ed177fc is described below
commit ed177fc5da2039c7f0a9103ea0226f68d4a40150
Author: sychen <[email protected]>
AuthorDate: Mon Mar 14 10:05:58 2022 +0800
[KYUUBI #2125] closeSession should avoid sending RPC after openSession fails
### _Why are the changes needed?_
https://github.com/apache/incubator-kyuubi/issues/2125
Now after the `openSession` call fails, `closeSession` is called. But
because there is no `_remoteSessionHandle`, the `CloseSession` RPC request
fails.
This does not need to send RPC and also increases the complexity of logging.
```
org.apache.kyuubi.KyuubiSQLException: Error while cleaning up the engine
resources
at
org.apache.kyuubi.KyuubiSQLException$.apply(KyuubiSQLException.scala:69)
at
org.apache.kyuubi.session.KyuubiSessionImpl.close(KyuubiSessionImpl.scala:156)
at
org.apache.kyuubi.session.KyuubiSessionManager.openSession(KyuubiSessionManager.scala:75)
at
org.apache.kyuubi.service.AbstractBackendService.openSession(AbstractBackendService.scala:45)
at
org.apache.kyuubi.service.ThriftBinaryFrontendService.getSessionHandle(ThriftBinaryFrontendService.scala:199)
```
### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including
negative and positive cases if possible
- [x] Add screenshots for manual tests if appropriate
- [x] [Run
test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests)
locally before make a pull request
Closes #2126 from cxzl25/KYUUBI-2125.
Closes #2125
2e96f418 [sychen] optimize closeSession
Authored-by: sychen <[email protected]>
Signed-off-by: Kent Yao <[email protected]>
(cherry picked from commit 8c85480bcf5a52d2e0dad1586f5f21b957612bb1)
Signed-off-by: Kent Yao <[email protected]>
---
.../scala/org/apache/kyuubi/client/KyuubiSyncThriftClient.scala | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git
a/kyuubi-server/src/main/scala/org/apache/kyuubi/client/KyuubiSyncThriftClient.scala
b/kyuubi-server/src/main/scala/org/apache/kyuubi/client/KyuubiSyncThriftClient.scala
index 70c450b..0187ccb 100644
---
a/kyuubi-server/src/main/scala/org/apache/kyuubi/client/KyuubiSyncThriftClient.scala
+++
b/kyuubi-server/src/main/scala/org/apache/kyuubi/client/KyuubiSyncThriftClient.scala
@@ -79,10 +79,12 @@ class KyuubiSyncThriftClient private (protocol: TProtocol)
}
def closeSession(): Unit = {
- val req = new TCloseSessionReq(_remoteSessionHandle)
try {
- val resp = withLockAcquired(CloseSession(req))
- ThriftUtils.verifyTStatus(resp.getStatus)
+ if (_remoteSessionHandle != null) {
+ val req = new TCloseSessionReq(_remoteSessionHandle)
+ val resp = withLockAcquired(CloseSession(req))
+ ThriftUtils.verifyTStatus(resp.getStatus)
+ }
} catch {
case e: Exception =>
throw KyuubiSQLException("Error while cleaning up the engine
resources", e)