You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by fe...@apache.org on 2022/12/08 14:07:38 UTC
[incubator-kyuubi] branch branch-1.6 updated: [KYUUBI #3941] Reduce the same query state update
This is an automated email from the ASF dual-hosted git repository.
feiwang pushed a commit to branch branch-1.6
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git
The following commit(s) were added to refs/heads/branch-1.6 by this push:
new f88ec8aa0 [KYUUBI #3941] Reduce the same query state update
f88ec8aa0 is described below
commit f88ec8aa02e06ecf3ac4eca9fa7043194921c1a7
Author: fwang12 <fw...@ebay.com>
AuthorDate: Thu Dec 8 22:07:18 2022 +0800
[KYUUBI #3941] Reduce the same query state update
### _Why are the changes needed?_
Reduce the same query state update.
### _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
- [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
Closes #3941 from turboFei/log_state.
Closes #3941
ef864a90f [fwang12] reduce the update state log
Authored-by: fwang12 <fw...@ebay.com>
Signed-off-by: fwang12 <fw...@ebay.com>
(cherry picked from commit 45533536a43224c18dc146577677360be2563d63)
Signed-off-by: fwang12 <fw...@ebay.com>
---
.../org/apache/kyuubi/operation/ExecuteStatement.scala | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/ExecuteStatement.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/ExecuteStatement.scala
index bd7cfe041..7352b10aa 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/ExecuteStatement.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/ExecuteStatement.scala
@@ -19,11 +19,12 @@ package org.apache.kyuubi.operation
import scala.collection.JavaConverters._
-import org.apache.hive.service.rpc.thrift.{TGetOperationStatusResp, TProtocolVersion}
+import org.apache.hive.service.rpc.thrift.{TGetOperationStatusResp, TOperationState, TProtocolVersion}
import org.apache.hive.service.rpc.thrift.TOperationState._
import org.apache.kyuubi.KyuubiSQLException
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
@@ -78,6 +79,8 @@ class ExecuteStatement(
}
var isComplete = false
+ var lastState: TOperationState = null
+ var lastStateUpdateTime: Long = 0L
while (!isComplete) {
fetchQueryLog()
verifyTStatus(statusResp.getStatus)
@@ -85,7 +88,12 @@ class ExecuteStatement(
setOperationJobProgress(statusResp.getProgressUpdateResponse)
}
val remoteState = statusResp.getOperationState
- info(s"Query[$statementId] in ${remoteState.name()}")
+ if (lastState != remoteState ||
+ System.currentTimeMillis() - lastStateUpdateTime > DEFAULT_SAME_STATE_UPDATE_INTERVAL) {
+ lastStateUpdateTime = System.currentTimeMillis()
+ info(s"Query[$statementId] in ${remoteState.name()}")
+ }
+ lastState = remoteState
isComplete = true
remoteState match {
case INITIALIZED_STATE | PENDING_STATE | RUNNING_STATE =>
@@ -165,3 +173,7 @@ class ExecuteStatement(
EventBus.post(KyuubiOperationEvent(this))
}
}
+
+object ExecuteStatement {
+ final val DEFAULT_SAME_STATE_UPDATE_INTERVAL = 5000L
+}