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/04/24 13:41:08 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #2450] Update lastAccessTime in getStatus and add opHandle to opHandleSet before run

This is an automated email from the ASF dual-hosted git repository.

feiwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 86f016d94 [KYUUBI #2450] Update lastAccessTime in getStatus and add opHandle to opHandleSet before run
86f016d94 is described below

commit 86f016d941af1ddd009ce08bd66e1c014fd0fdc7
Author: wforget <64...@qq.com>
AuthorDate: Sun Apr 24 21:41:01 2022 +0800

    [KYUUBI #2450] Update lastAccessTime in getStatus and add opHandle to opHandleSet before run
    
    ### _Why are the changes needed?_
    
    close #2450
    
    1. The client obtains the status of the Operation by calling getOperationStatus cyclically. We need to update the lastAccessTime in the getStatus method to prevent timeouts caused by long-running.
    2. We need to add opHandle to opHandleSet before running to avoid losing Operation by calling close during Operation running.
    
    ### _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.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #2452 from wForget/KYUUBI-2450.
    
    Closes #2450
    
    35002396 [wforget] add opHandle to opHandleSet before run
    dc82f65b [wforget] unnecessary change
    cca3377c [wforget] [KYUUBI-2450] Update lastAccessTime in getStatus and catch close launchEngineOp exception
    
    Authored-by: wforget <64...@qq.com>
    Signed-off-by: Fei Wang <fw...@ebay.com>
---
 .../src/main/scala/org/apache/kyuubi/operation/AbstractOperation.scala  | 1 +
 .../src/main/scala/org/apache/kyuubi/session/AbstractSession.scala      | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/kyuubi-common/src/main/scala/org/apache/kyuubi/operation/AbstractOperation.scala b/kyuubi-common/src/main/scala/org/apache/kyuubi/operation/AbstractOperation.scala
index 92b1188f5..272095804 100644
--- a/kyuubi-common/src/main/scala/org/apache/kyuubi/operation/AbstractOperation.scala
+++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/operation/AbstractOperation.scala
@@ -174,6 +174,7 @@ abstract class AbstractOperation(opType: OperationType, session: Session)
   override def getHandle: OperationHandle = handle
 
   override def getStatus: OperationStatus = {
+    lastAccessTime = System.currentTimeMillis()
     OperationStatus(
       state,
       createTime,
diff --git a/kyuubi-common/src/main/scala/org/apache/kyuubi/session/AbstractSession.scala b/kyuubi-common/src/main/scala/org/apache/kyuubi/session/AbstractSession.scala
index f1602ca77..750fadbfc 100644
--- a/kyuubi-common/src/main/scala/org/apache/kyuubi/session/AbstractSession.scala
+++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/session/AbstractSession.scala
@@ -90,8 +90,8 @@ abstract class AbstractSession(
   protected def runOperation(operation: Operation): OperationHandle = {
     try {
       val opHandle = operation.getHandle
-      operation.run()
       opHandleSet.add(opHandle)
+      operation.run()
       opHandle
     } catch {
       case e: KyuubiSQLException =>