You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2012/11/27 18:34:25 UTC

svn commit: r1414279 - /hive/branches/branch-0.10/ql/src/java/org/apache/hadoop/hive/ql/Driver.java

Author: hashutosh
Date: Tue Nov 27 17:34:24 2012
New Revision: 1414279

URL: http://svn.apache.org/viewvc?rev=1414279&view=rev
Log:
HIVE-3723 : Hive Driver leaks ZooKeeper connections (Gunther Hagleitner via Ashutosh Chauhan)

Modified:
    hive/branches/branch-0.10/ql/src/java/org/apache/hadoop/hive/ql/Driver.java

Modified: hive/branches/branch-0.10/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.10/ql/src/java/org/apache/hadoop/hive/ql/Driver.java?rev=1414279&r1=1414278&r2=1414279&view=diff
==============================================================================
--- hive/branches/branch-0.10/ql/src/java/org/apache/hadoop/hive/ql/Driver.java (original)
+++ hive/branches/branch-0.10/ql/src/java/org/apache/hadoop/hive/ql/Driver.java Tue Nov 27 17:34:24 2012
@@ -845,20 +845,6 @@ public class Driver implements CommandPr
   }
 
   /**
-   * Release all the locks acquired implicitly by the statement. Note that the locks acquired with
-   * 'keepAlive' set to True are not released.
-   **/
-  private void releaseLocks() {
-    if (ctx != null && ctx.getHiveLockMgr() != null) {
-      try {
-        ctx.getHiveLockMgr().close();
-        ctx.setHiveLocks(null);
-      } catch (LockException e) {
-      }
-    }
-  }
-
-  /**
    * @param hiveLocks
    *          list of hive locks to be released Release all the locks specified. If some of the
    *          locks have already been released, ignore them
@@ -1488,7 +1474,18 @@ public class Driver implements CommandPr
   }
 
   public void destroy() {
-    releaseLocks();
+    if (ctx != null) {
+      releaseLocks(ctx.getHiveLocks());
+    }
+
+    if (hiveLockMgr != null) {
+      try {
+        hiveLockMgr.close();
+      } catch(LockException e) {
+        LOG.warn("Exception in closing hive lock manager. "
+            + org.apache.hadoop.util.StringUtils.stringifyException(e));
+      }
+    }
   }
 
   public org.apache.hadoop.hive.ql.plan.api.Query getQueryPlan() throws IOException {