Skip to content

Commit 9ea0a1b

Browse files
lsm1cxzl25
authored andcommitted
[KYUUBI #5244][Improvement] Make engineAliveMaxFailCount configurable
### _Why are the changes needed?_ close #5244 ### _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 #5251 from lsm1/branch-kyuubi-5244. Closes #5244 bcadaa5 [senmiaoliu] rename a6c9277 [senmiaoliu] fix style 1f38fa7 [senmiaoliu] fix style 3ff57ff [senmiaoliu] Make engineAliveMaxFailCount configurable Authored-by: senmiaoliu <[email protected]> Signed-off-by: Shaoyun Chen <[email protected]>
1 parent 5ec2c2e commit 9ea0a1b

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

Diff for: docs/configuration/settings.md

+1
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ You can configure the Kyuubi properties in `$KYUUBI_HOME/conf/kyuubi-defaults.co
414414
| kyuubi.session.conf.ignore.list || A comma-separated list of ignored keys. If the client connection contains any of them, the key and the corresponding value will be removed silently during engine bootstrap and connection setup. Note that this rule is for server-side protection defined via administrators to prevent some essential configs from tampering but will not forbid users to set dynamic configurations via SET syntax. | set | 1.2.0 |
415415
| kyuubi.session.conf.profile | &lt;undefined&gt; | Specify a profile to load session-level configurations from `$KYUUBI_CONF_DIR/kyuubi-session-<profile>.conf`. This configuration will be ignored if the file does not exist. This configuration only takes effect when `kyuubi.session.conf.advisor` is set as `org.apache.kyuubi.session.FileSessionConfAdvisor`. | string | 1.7.0 |
416416
| kyuubi.session.conf.restrict.list || A comma-separated list of restricted keys. If the client connection contains any of them, the connection will be rejected explicitly during engine bootstrap and connection setup. Note that this rule is for server-side protection defined via administrators to prevent some essential configs from tampering but will not forbid users to set dynamic configurations via SET syntax. | set | 1.2.0 |
417+
| kyuubi.session.engine.alive.max.failures | 3 | The maximum number of failures allowed for the engine. | int | 1.8.0 |
417418
| kyuubi.session.engine.alive.probe.enabled | false | Whether to enable the engine alive probe, it true, we will create a companion thrift client that keeps sending simple requests to check whether the engine is alive. | boolean | 1.6.0 |
418419
| kyuubi.session.engine.alive.probe.interval | PT10S | The interval for engine alive probe. | duration | 1.6.0 |
419420
| kyuubi.session.engine.alive.timeout | PT2M | The timeout for engine alive. If there is no alive probe success in the last timeout window, the engine will be marked as no-alive. | duration | 1.6.0 |

Diff for: kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala

+8
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,14 @@ object KyuubiConf {
14231423
.timeConf
14241424
.createWithDefault(Duration.ofSeconds(15).toMillis)
14251425

1426+
val ENGINE_ALIVE_MAX_FAILURES: ConfigEntry[Int] =
1427+
buildConf("kyuubi.session.engine.alive.max.failures")
1428+
.doc("The maximum number of failures allowed for the engine.")
1429+
.version("1.8.0")
1430+
.intConf
1431+
.checkValue(_ > 0, "Must be positive")
1432+
.createWithDefault(3)
1433+
14261434
val ENGINE_ALIVE_PROBE_ENABLED: ConfigEntry[Boolean] =
14271435
buildConf("kyuubi.session.engine.alive.probe.enabled")
14281436
.doc("Whether to enable the engine alive probe, it true, we will create a companion thrift" +

Diff for: kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala

+6-6
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,10 @@ class KyuubiSessionImpl(
287287
}
288288

289289
@volatile private var engineLastAlive: Long = _
290-
val engineAliveTimeout = sessionConf.get(KyuubiConf.ENGINE_ALIVE_TIMEOUT)
291-
val aliveProbeEnabled = sessionConf.get(KyuubiConf.ENGINE_ALIVE_PROBE_ENABLED)
292-
var engineAliveMaxFailCount = 3
293-
var engineAliveFailCount = 0
290+
private val engineAliveTimeout = sessionConf.get(KyuubiConf.ENGINE_ALIVE_TIMEOUT)
291+
private val aliveProbeEnabled = sessionConf.get(KyuubiConf.ENGINE_ALIVE_PROBE_ENABLED)
292+
private val engineAliveMaxFailCount = sessionConf.get(KyuubiConf.ENGINE_ALIVE_MAX_FAILURES)
293+
private var engineAliveFailCount = 0
294294

295295
def checkEngineConnectionAlive(): Boolean = {
296296
try {
@@ -306,7 +306,7 @@ class KyuubiSessionImpl(
306306
engineAliveFailCount = engineAliveFailCount + 1
307307
if (now - engineLastAlive > engineAliveTimeout &&
308308
engineAliveFailCount >= engineAliveMaxFailCount) {
309-
error(s"The engineRef[${engine.getEngineRefId}] is marked as not alive "
309+
error(s"The engineRef[${engine.getEngineRefId()}] is marked as not alive "
310310
+ s"due to a lack of recent successful alive probes. "
311311
+ s"The time since last successful probe: "
312312
+ s"${now - engineLastAlive} ms exceeds the timeout of $engineAliveTimeout ms. "
@@ -315,7 +315,7 @@ class KyuubiSessionImpl(
315315
false
316316
} else {
317317
warn(
318-
s"The engineRef[${engine.getEngineRefId}] alive probe fails, " +
318+
s"The engineRef[${engine.getEngineRefId()}] alive probe fails, " +
319319
s"${now - engineLastAlive} ms exceeds timeout $engineAliveTimeout ms, " +
320320
s"and has failed $engineAliveFailCount times.",
321321
e)

0 commit comments

Comments
 (0)