You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2017/01/11 21:06:34 UTC

hive git commit: HIVE-15551 : memory leak in directsql for mysql+bonecp specific initialization (Xiaomin Zhang, reviewed by Sergey Shelukhin)

Repository: hive
Updated Branches:
  refs/heads/master af544f0cc -> 2d813f4d4


HIVE-15551 : memory leak in directsql for mysql+bonecp specific initialization (Xiaomin Zhang, reviewed by Sergey Shelukhin)


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

Branch: refs/heads/master
Commit: 2d813f4d4a0bb42345d153c362f7416f05ab2749
Parents: af544f0
Author: Sergey Shelukhin <se...@apache.org>
Authored: Wed Jan 11 13:05:59 2017 -0800
Committer: Sergey Shelukhin <se...@apache.org>
Committed: Wed Jan 11 13:06:16 2017 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/2d813f4d/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
index be67ccc..85a6d0d 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
@@ -22,6 +22,7 @@ import static org.apache.commons.lang.StringUtils.join;
 import static org.apache.commons.lang.StringUtils.repeat;
 
 import java.sql.Connection;
+import java.sql.Statement;
 import java.sql.SQLException;
 import java.text.ParseException;
 import java.util.ArrayList;
@@ -242,12 +243,17 @@ class MetaStoreDirectSql {
 
   private void executeNoResult(final String queryText) throws SQLException {
     JDOConnection jdoConn = pm.getDataStoreConnection();
+    Statement statement = null;
     boolean doTrace = LOG.isDebugEnabled();
     try {
       long start = doTrace ? System.nanoTime() : 0;
-      ((Connection)jdoConn.getNativeConnection()).createStatement().execute(queryText);
+      statement = ((Connection)jdoConn.getNativeConnection()).createStatement();
+      statement.execute(queryText);
       timingTrace(doTrace, queryText, start, doTrace ? System.nanoTime() : 0);
     } finally {
+      if(statement != null){
+          statement.close();
+      }
       jdoConn.close(); // We must release the connection before we call other pm methods.
     }
   }