Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/configuration/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ You can configure the Kyuubi properties in `$KYUUBI_HOME/conf/kyuubi-defaults.co
| kyuubi.metadata.cleaner.interval | PT30M | The interval to check and clean expired metadata. | duration | 1.6.0 |
| kyuubi.metadata.max.age | PT72H | The maximum age of metadata, the metadata exceeding the age will be cleaned. | duration | 1.6.0 |
| kyuubi.metadata.recovery.threads | 10 | The number of threads for recovery from the metadata store when the Kyuubi server restarts. | int | 1.6.0 |
| kyuubi.metadata.recovery.waitEngineSubmission | false | Whether a metadata recovery task should wait for its corresponding engine submission to complete before finishing. All recovery tasks are submitted to a fixed thread pool controlled by kyuubi.metadata.recovery.threads. If true, a task blocks until the engine submission is done, helping throttle the load on the system if kyuubi.session.engine.startup.waitCompletion is false. If false, the task returns immediately after opening the session without waiting. | boolean | 1.10.3 |
| kyuubi.metadata.request.async.retry.enabled | true | Whether to retry in async when metadata request failed. When true, return success response immediately even the metadata request failed, and schedule it in background until success, to tolerate long-time metadata store outages w/o blocking the submission request. | boolean | 1.7.0 |
| kyuubi.metadata.request.async.retry.queue.size | 65536 | The maximum queue size for buffering metadata requests in memory when the external metadata storage is down. Requests will be dropped if the queue exceeds. Only take affect when kyuubi.metadata.request.async.retry.enabled is `true`. | int | 1.6.0 |
| kyuubi.metadata.request.async.retry.threads | 10 | Number of threads in the metadata request async retry manager thread pool. Only take affect when kyuubi.metadata.request.async.retry.enabled is `true`. | int | 1.6.0 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2104,6 +2104,19 @@ object KyuubiConf {
.intConf
.createWithDefault(10)

val METADATA_RECOVERY_WAIT_ENGINE_SUBMISSION: ConfigEntry[Boolean] =
buildConf("kyuubi.metadata.recovery.waitEngineSubmission")
.serverOnly
.doc("Whether a metadata recovery task should wait for its corresponding engine " +
"submission to complete before finishing. All recovery tasks are submitted to a fixed " +
s"thread pool controlled by ${METADATA_RECOVERY_THREADS.key}. If true, a task blocks " +
"until the engine submission is done, helping throttle the load on the system " +
s"if ${SESSION_ENGINE_STARTUP_WAIT_COMPLETION.key} is false. " +
"If false, the task returns immediately after opening the session without waiting.")
.version("1.10.3")
.booleanConf
.createWithDefault(false)

val METADATA_REQUEST_RETRY_INTERVAL: ConfigEntry[Long] =
buildConf("kyuubi.metadata.request.retry.interval")
.serverOnly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import org.apache.kyuubi.config.KyuubiConf
import org.apache.kyuubi.config.KyuubiConf._
import org.apache.kyuubi.metrics.{MetricsConstants, MetricsSystem}
import org.apache.kyuubi.metrics.MetricsConstants.OPERATION_BATCH_PENDING_MAX_ELAPSE
import org.apache.kyuubi.operation.OperationState
import org.apache.kyuubi.server.api.v1.ApiRootResource
import org.apache.kyuubi.server.http.authentication.{AuthenticationFilter, KyuubiHttpAuthenticationFactory}
import org.apache.kyuubi.server.ui.{JettyServer, JettyUtils}
Expand Down Expand Up @@ -181,6 +182,7 @@ class KyuubiRestFrontendService(override val serverable: Serverable)
@VisibleForTesting
private[kyuubi] def recoverBatchSessions(): Unit = withBatchRecoveryLockRequired {
val recoveryNumThreads = conf.get(METADATA_RECOVERY_THREADS)
val recoveryWaitEngineSubmission = conf.get(METADATA_RECOVERY_WAIT_ENGINE_SUBMISSION)
val batchRecoveryExecutor =
ThreadUtils.newDaemonFixedThreadPool(recoveryNumThreads, "batch-recovery-executor")
try {
Expand All @@ -190,7 +192,18 @@ class KyuubiRestFrontendService(override val serverable: Serverable)
val batchId = batchSession.batchJobSubmissionOp.batchId
try {
val task: Future[Unit] = batchRecoveryExecutor.submit(() =>
Utils.tryLogNonFatalError(sessionManager.openBatchSession(batchSession)))
Utils.tryLogNonFatalError {
sessionManager.openBatchSession(batchSession)
if (recoveryWaitEngineSubmission) {
info(s"Waiting for batch[$batchId] engine submission during recovery")
val batchOp = batchSession.batchJobSubmissionOp
while (batchSession.getSessionEvent.forall(_.exception.isEmpty) &&
!batchOp.appStarted &&
!OperationState.isTerminal(batchOp.getStatus.state)) {
Thread.sleep(300)
}
}
})
Some(task -> batchId)
} catch {
case e: Throwable =>
Expand Down
Loading