Skip to content

Commit

Permalink
config the interval for updating the same status for a query
Browse files Browse the repository at this point in the history
  • Loading branch information
turboFei committed Dec 11, 2022
1 parent 7aa3445 commit 57d7319
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,14 @@ object KyuubiConf {
.timeConf
.createWithDefault(Duration.ofSeconds(5).toMillis)

val OPERATION_STATUS_UPDATE_INTERVAL: ConfigEntry[Long] =
buildConf("kyuubi.operation.status.update.interval")
.internal
.doc("Interval(ms) for updating the same status for a query.")
.version("1.7.0")
.timeConf
.createWithDefault(Duration.ofSeconds(5).toMillis)

val OPERATION_FORCE_CANCEL: ConfigEntry[Boolean] =
buildConf("kyuubi.operation.interrupt.on.cancel")
.doc("When true, all running tasks will be interrupted if one cancels a query. " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import org.apache.hive.service.rpc.thrift.{TGetOperationStatusResp, TOperationSt
import org.apache.hive.service.rpc.thrift.TOperationState._

import org.apache.kyuubi.KyuubiSQLException
import org.apache.kyuubi.config.KyuubiConf
import org.apache.kyuubi.events.{EventBus, KyuubiOperationEvent}
import org.apache.kyuubi.operation.ExecuteStatement.DEFAULT_SAME_STATE_UPDATE_INTERVAL
import org.apache.kyuubi.operation.FetchOrientation.FETCH_NEXT
import org.apache.kyuubi.operation.OperationState.OperationState
import org.apache.kyuubi.operation.log.OperationLog
Expand Down Expand Up @@ -82,6 +82,8 @@ class ExecuteStatement(
var isComplete = false
var lastState: TOperationState = null
var lastStateUpdateTime: Long = 0L
val stateUpdateInterval =
session.sessionManager.getConf.get(KyuubiConf.OPERATION_STATUS_UPDATE_INTERVAL)
while (!isComplete) {
fetchQueryLog()
verifyTStatus(statusResp.getStatus)
Expand All @@ -90,7 +92,7 @@ class ExecuteStatement(
}
val remoteState = statusResp.getOperationState
if (lastState != remoteState ||
System.currentTimeMillis() - lastStateUpdateTime > DEFAULT_SAME_STATE_UPDATE_INTERVAL) {
System.currentTimeMillis() - lastStateUpdateTime > stateUpdateInterval) {
lastStateUpdateTime = System.currentTimeMillis()
info(s"Query[$statementId] in ${remoteState.name()}")
}
Expand Down Expand Up @@ -165,7 +167,3 @@ class ExecuteStatement(
EventBus.post(KyuubiOperationEvent(this))
}
}

object ExecuteStatement {
final val DEFAULT_SAME_STATE_UPDATE_INTERVAL = 5000L
}

0 comments on commit 57d7319

Please sign in to comment.