This is an automated email from the ASF dual-hosted git repository.
feiwang 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 d6f07a6b64 [KYUUBI #7011] Set kyuubi session engine client after
opening engine session successfully
d6f07a6b64 is described below
commit d6f07a6b64c8ff635335540b82887f4639e14b4b
Author: Wang, Fei <[email protected]>
AuthorDate: Thu Apr 3 09:41:27 2025 -0700
[KYUUBI #7011] Set kyuubi session engine client after opening engine
session successfully
### Why are the changes needed?
Since https://github.com/apache/kyuubi/pull/3618
Kyuubi server could retry opening the engine when encountering a special
error.
https://github.com/apache/kyuubi/blob/1937dd93f9488cd209df96c603472134c3fab22d/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala#L177-L212
The `_client` might be reset and closed.
So, we shall set `_client` after open engine session successfully, as the
`client` method is a public method.
### How was this patch tested?
Existing UT.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #7011 from turboFei/client_ready.
Closes #7011
3ad57ee91 [Wang, Fei] fix npe
b956394fa [Wang, Fei] close internal engine client
523b48a4d [Wang, Fei] internal client
5baeedec1 [Wang, Fei] Revert "method"
84c808cfb [Wang, Fei] method
8efaa52f6 [Wang, Fei] check engine launched
Authored-by: Wang, Fei <[email protected]>
Signed-off-by: Wang, Fei <[email protected]>
---
.../scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git
a/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala
b/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala
index 6b4e2a2e7d..519e7881b4 100644
---
a/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala
+++
b/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala
@@ -167,6 +167,7 @@ class KyuubiSessionImpl(
warn(s"Error on de-registering engine [${engine.engineSpace}
$host:$port]", e)
}
+ var engineClient: KyuubiSyncThriftClient = null
try {
val passwd =
if (sessionManager.getConf.get(ENGINE_SECURITY_ENABLED)) {
@@ -174,9 +175,11 @@ class KyuubiSessionImpl(
} else {
Option(password).filter(_.nonEmpty).getOrElse("anonymous")
}
- _client = KyuubiSyncThriftClient.createClient(user, passwd, host,
port, sessionConf)
+ engineClient =
+ KyuubiSyncThriftClient.createClient(user, passwd, host, port,
sessionConf)
_engineSessionHandle =
- _client.openSession(protocol, user, passwd,
openEngineSessionConf)
+ engineClient.openSession(protocol, user, passwd,
openEngineSessionConf)
+ _client = engineClient
logSessionInfo(s"Connected to engine
[$host:$port]/[${client.engineId.getOrElse("")}]" +
s" with ${_engineSessionHandle}]")
shouldRetry = false
@@ -207,9 +210,9 @@ class KyuubiSessionImpl(
throw e
} finally {
attempt += 1
- if (shouldRetry && _client != null) {
+ if (shouldRetry && engineClient != null) {
try {
- _client.closeSession()
+ engineClient.closeSession()
} catch {
case e: Throwable =>
warn(