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

2016-04-07 Thread daijy
Repository: hive
Updated Branches:
  refs/heads/branch-1 4ac966cd8 -> bcbc41526


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/bcbc4152
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/bcbc4152
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/bcbc4152

Branch: refs/heads/branch-1
Commit: bcbc41526b9562a406899731f62bf55825130c6e
Parents: 4ac966c
Author: Daniel Dai 
Authored: Thu Apr 7 14:03:01 2016 -0700
Committer: Daniel Dai 
Committed: Thu Apr 7 14:03:01 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/hive/blob/bcbc4152/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 0392eb5..65f7f52 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/bcbc4152/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 b2bc71e..5014f1d 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
@@ -407,6 +407,9 @@ public class Driver implements CommandProcessor {
   // Initialize the transaction manager.  This must be done before analyze 
is called.
   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() {
@@ -1930,10 +1933,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 {



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

2015-12-24 Thread gunther
Repository: hive
Updated Branches:
  refs/heads/branch-2.0 5c66ed670 -> 237729430


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/23772943
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/23772943
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/23772943

Branch: refs/heads/branch-2.0
Commit: 23772943093affc49eeda5655205c6ae9cc2d26c
Parents: 5c66ed6
Author: Gunther Hagleitner 
Authored: Thu Dec 24 13:18:59 2015 -0800
Committer: Gunther Hagleitner 
Committed: Thu Dec 24 13:19:39 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/23772943/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/23772943/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 2deeb48..485e901 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
@@ -420,6 +420,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() {
@@ -1955,10 +1957,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 {



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

2015-12-24 Thread gunther
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 
Authored: Thu Dec 24 13:18:59 2015 -0800
Committer: Gunther Hagleitner 
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 {