Skip to content

Commit

Permalink
[KYUUBI apache#6376] Improve closeEngine method names and logs due to…
Browse files Browse the repository at this point in the history
… closeSession

# 🔍 Description
## Issue References 🔗

This pull request aims to improve closeEngine method names and logs due to closeSession.

when the share level is `CONNECTION`, closeSession triggers the closeEngine, there are some minor issues with logging and method name.

## Describe Your Solution 🔧

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

## Types of changes 🔖

- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Test Plan 🧪

#### Behavior Without This Pull Request ⚰️

#### Behavior With This Pull Request 🎉

#### Related Unit Tests

---

# Checklist 📝

- [x] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html)

**Be nice. Be informative.**

Closes apache#6376 from yikf/rename-close-session.

Closes apache#6376

b03661b [yikaifei] rename closeSession

Authored-by: yikaifei <yikaifei@apache.org>
Signed-off-by: yikaifei <yikaifei@apache.org>
  • Loading branch information
yikf committed May 11, 2024
1 parent f916e62 commit 4642550
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ class ChatSessionManager(name: String)
override def closeSession(sessionHandle: SessionHandle): Unit = {
super.closeSession(sessionHandle)
if (conf.get(ENGINE_SHARE_LEVEL) == ShareLevel.CONNECTION.toString) {
info("Session stopped due to shared level is Connection.")
stopSession()
info("Chat engine stopped due to session stopped and shared level is CONNECTION.")
stopEngine()
}
}

private def stopSession(): Unit = {
private def stopEngine(): Unit = {
ChatEngine.currentEngine.foreach(_.stop())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ class FlinkSQLSessionManager(engineContext: DefaultContext)
warn(s"Error closing session $sessionHandle", t)
}
if (shareLevel == ShareLevel.CONNECTION) {
info("Session stopped due to shared level is Connection.")
stopSession()
info("Flink engine stopped due to session stopped and shared level is CONNECTION.")
stopEngine()
}
}

private def stopSession(): Unit = {
private def stopEngine(): Unit = {
FlinkSQLEngine.currentEngine.foreach(_.stop())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class HiveSessionManager(engine: HiveSQLEngine) extends SessionManager("HiveSess
override def closeSession(sessionHandle: SessionHandle): Unit = {
super.closeSession(sessionHandle)
if (conf.get(ENGINE_SHARE_LEVEL) == ShareLevel.CONNECTION.toString) {
info("Session stopped due to shared level is Connection.")
info("Hive engine stopped due to session stopped and shared level is CONNECTION.")
engine.stop()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ class JdbcSessionManager(name: String)
override def closeSession(sessionHandle: SessionHandle): Unit = {
super.closeSession(sessionHandle)
if (conf.get(ENGINE_SHARE_LEVEL) == ShareLevel.CONNECTION.toString) {
info("Session stopped due to shared level is Connection.")
stopSession()
info("JDBC engine stopped due to session stopped and shared level is CONNECTION.")
stopEngine()
}
}

private def stopSession(): Unit = {
private def stopEngine(): Unit = {
JdbcSQLEngine.currentEngine.foreach { engine =>
engine.selfExited = true
engine.stop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,12 @@ class SparkSQLSessionManager private (name: String, spark: SparkSession)
}
}
if (shareLevel == ShareLevel.CONNECTION) {
info("Session stopped due to shared level is Connection.")
stopSession()
info("Spark engine stopped due to session stopped and shared level is CONNECTION.")
stopEngine()
}
}

private def stopSession(): Unit = {
private def stopEngine(): Unit = {
SparkSQLEngine.currentEngine.foreach(_.stop())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ class TrinoSessionManager
override def closeSession(sessionHandle: SessionHandle): Unit = {
super.closeSession(sessionHandle)
if (conf.get(ENGINE_SHARE_LEVEL) == ShareLevel.CONNECTION.toString) {
info("Session stopped due to shared level is Connection.")
stopSession()
info("Trino engine stopped due to session stopped and shared level is CONNECTION.")
stopEngine()
}
}

private def stopSession(): Unit = {
private def stopEngine(): Unit = {
TrinoSqlEngine.currentEngine.foreach(_.stop())
}

Expand Down

0 comments on commit 4642550

Please sign in to comment.