hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gunt...@apache.org
Subject hive git commit: HIVE-12741: HS2 ShutdownHookManager holds extra of Driver instance in master/branch-2.0 (Thejas Nair, reviewed by Daniel Dai)
Date Thu, 24 Dec 2015 21:19:22 GMT
Repository: hive
Updated Branches:
  refs/heads/master 0b810991a -> 267b4e811


HIVE-12741: HS2 ShutdownHookManager holds extra of Driver instance in master/branch-2.0 (Thejas
Nair, reviewed by Daniel Dai)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/267b4e81
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/267b4e81
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/267b4e81

Branch: refs/heads/master
Commit: 267b4e81153756ddb9ce6af23cb2d50e8161de08
Parents: 0b81099
Author: Gunther Hagleitner <gunther@apache.org>
Authored: Thu Dec 24 13:18:59 2015 -0800
Committer: Gunther Hagleitner <gunther@apache.org>
Committed: Thu Dec 24 13:18:59 2015 -0800

----------------------------------------------------------------------
 .../java/org/apache/hive/common/util/ShutdownHookManager.java  | 5 ++++-
 ql/src/java/org/apache/hadoop/hive/ql/Driver.java              | 6 +++---
 2 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/267b4e81/common/src/java/org/apache/hive/common/util/ShutdownHookManager.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hive/common/util/ShutdownHookManager.java b/common/src/java/org/apache/hive/common/util/ShutdownHookManager.java
index b5f7e69..5efeda9 100644
--- a/common/src/java/org/apache/hive/common/util/ShutdownHookManager.java
+++ b/common/src/java/org/apache/hive/common/util/ShutdownHookManager.java
@@ -172,9 +172,12 @@ public class ShutdownHookManager {
    *
    * @param shutdownHook shutdownHook to remove.
    * @return TRUE if the shutdownHook was registered and removed,
-   * FALSE otherwise.
+   * FALSE otherwise (including when shutdownHook == null)
    */
   public static boolean removeShutdownHook(Runnable shutdownHook) {
+    if (shutdownHook == null) {
+      return false;
+    }
     return MGR.removeShutdownHookInternal(shutdownHook);
   }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/267b4e81/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/Driver.java b/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
index 52f5528..29e6315 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
@@ -413,6 +413,8 @@ public class Driver implements CommandProcessor {
       final HiveTxnManager txnManager = SessionState.get().initTxnMgr(conf);
       // In case when user Ctrl-C twice to kill Hive CLI JVM, we want to release locks
 
+      // if compile is being called multiple times, clear the old shutdownhook
+      ShutdownHookManager.removeShutdownHook(shutdownRunner);
       shutdownRunner = new Runnable() {
         @Override
         public void run() {
@@ -1910,10 +1912,8 @@ public class Driver implements CommandProcessor {
         LOG.warn("Exception when releasing locking in destroy: " +
             e.getMessage());
       }
-      if (shutdownRunner != null) {
-        ShutdownHookManager.removeShutdownHook(shutdownRunner);
-      }
     }
+    ShutdownHookManager.removeShutdownHook(shutdownRunner);
   }
 
   public org.apache.hadoop.hive.ql.plan.api.Query getQueryPlan() throws IOException {


Mime
View raw message