You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ma...@apache.org on 2020/07/30 15:26:29 UTC

[hive] branch master updated: HIVE-23894 - SubmitDag should not be retried incase of query cancel (#1293)

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

mahesh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new ee27dd3  HIVE-23894 - SubmitDag should not be retried incase of query cancel (#1293)
ee27dd3 is described below

commit ee27dd3f61db407c249716b4d6fd29a5c0c6539e
Author: Naresh P R <pr...@gmail.com>
AuthorDate: Thu Jul 30 08:26:16 2020 -0700

    HIVE-23894 - SubmitDag should not be retried incase of query cancel (#1293)
---
 .../apache/hadoop/hive/ql/exec/tez/TezTask.java    | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezTask.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezTask.java
index 3d27632..b086fc0 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezTask.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezTask.java
@@ -578,6 +578,11 @@ public class TezTask extends Task<TezWork> {
         dagClient = sessionState.getSession().submitDAG(dag);
       }
     } catch (Exception e) {
+      if (this.isShutdown) {
+        // Incase of taskShutdown, no need to retry
+        sessionDestroyOrReturnToPool(sessionStateRef, sessionState);
+        throw e;
+      }
       // In case of any other exception, retry. If this also fails, report original error and exit.
       try {
         console.printInfo("Dag submit failed due to " + e.getMessage() + " stack trace: "
@@ -588,12 +593,7 @@ public class TezTask extends Task<TezWork> {
         // we failed to submit after retrying.
         // If this is a non-pool session, destroy it.
         // Otherwise move it to sessionPool, reopen will retry.
-        sessionStateRef.value = null;
-        if (sessionState.isDefault() && sessionState instanceof TezSessionPoolSession) {
-          sessionState.returnToSessionManager();
-        } else {
-          sessionState.destroy();
-        }
+        sessionDestroyOrReturnToPool(sessionStateRef, sessionState);
         throw retryException;
       }
     }
@@ -602,6 +602,16 @@ public class TezTask extends Task<TezWork> {
     return new SyncDagClient(dagClient);
   }
 
+  private void sessionDestroyOrReturnToPool(Ref<TezSessionState> sessionStateRef,
+      TezSessionState sessionState) throws Exception{
+    sessionStateRef.value = null;
+    if (sessionState.isDefault() && sessionState instanceof TezSessionPoolSession) {
+      sessionState.returnToSessionManager();
+    } else {
+      sessionState.destroy();
+    }
+  }
+
   /*
    * close will move the temp files into the right place for the fetch
    * task. If the job has failed it will clean up the files.