pan3793 commented on code in PR #4848:
URL: https://github.com/apache/kyuubi/pull/4848#discussion_r1217549180
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala:
##########
@@ -283,4 +284,41 @@ class KyuubiSessionImpl(
case _ => super.executeStatement(statement, confOverlay, runAsync,
queryTimeout)
}
}
+
+ private var engineLastAlive: Long = _
+ val engineAliveTimeout = sessionConf.get(KyuubiConf.ENGINE_ALIVE_TIMEOUT)
+ val aliveProbeEnabled =
sessionConf.get(KyuubiConf.ENGINE_ALIVE_PROBE_ENABLED)
+ var engineAliveMaxFailCount = 3
+ var engineAliveFailCount = 0
+
+ def checkEngineAlive(): Boolean = {
+ try {
+ if (!aliveProbeEnabled) return true
+ getInfo(TGetInfoType.CLI_DBMS_VER)
+ engineLastAlive = System.currentTimeMillis()
+ engineAliveFailCount = 0
+ true
+ } catch {
+ case e: Throwable =>
+ val now = System.currentTimeMillis()
+ engineAliveFailCount = engineAliveFailCount + 1
+ if (now - engineLastAlive > engineAliveTimeout &&
+ engineAliveFailCount >= engineAliveMaxFailCount) {
+ error(s"The engineRef[${engine.getEngineRefId}] is marked as not
alive "
+ + s"due to a lack of recent successful alive probes. "
+ + s"The time since last successful probe:"
+ + s" ${now - engineLastAlive} ms exceeds the timeout of
$engineAliveTimeout ms. "
+ + s"The engine has failed $engineAliveFailCount times,"
+ + s" surpassing the maximum failure count of
$engineAliveMaxFailCount.")
+ false
+ } else {
+ warn(
+ s"The engineRef[${engine.getEngineRefId}] alive probe fails," +
+ s"${now - engineLastAlive} ms exceeds timeout
$engineAliveTimeout ms," +
+ s" and has failed $engineAliveFailCount times ",
Review Comment:
let's unify the multi-line string style: make sure space is added properly
between lines and always put the space at the end of the line
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]