hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject svn commit: r1063062 - in /hive/trunk: CHANGES.txt ql/src/java/org/apache/hadoop/hive/ql/Driver.java ql/src/java/org/apache/hadoop/hive/ql/exec/FetchTask.java
Date Mon, 24 Jan 2011 23:31:28 GMT
Author: namit
Date: Mon Jan 24 23:31:28 2011
New Revision: 1063062

URL: http://svn.apache.org/viewvc?rev=1063062&view=rev
Log:
HIVE-1908 FileHandler leak on partial iteration of the resultset
(Chinna Rao Lalam via namit)


Modified:
    hive/trunk/CHANGES.txt
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchTask.java

Modified: hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hive/trunk/CHANGES.txt?rev=1063062&r1=1063061&r2=1063062&view=diff
==============================================================================
--- hive/trunk/CHANGES.txt (original)
+++ hive/trunk/CHANGES.txt Mon Jan 24 23:31:28 2011
@@ -719,6 +719,9 @@ Trunk -  Unreleased
     HIVE-1897 Alter command execution "when HDFS is down" results in holding
     stale data in MetaStore (Chinna Rao Lalam via namit)
 
+    HIVE-1908 FileHandler leak on partial iteration of the resultset
+    (Chinna Rao Lalam via namit)
+
   TESTS
 
     HIVE-1464. improve  test query performance

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java?rev=1063062&r1=1063061&r2=1063062&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java Mon Jan 24 23:31:28 2011
@@ -36,6 +36,7 @@ import java.util.Set;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hive.common.JavaUtils;
 import org.apache.hadoop.hive.conf.HiveConf;
@@ -1130,9 +1131,26 @@ public class Driver implements CommandPr
 
   public int close() {
     try {
+      if (plan != null) {
+        FetchTask fetchTask = plan.getFetchTask();
+        if (null != fetchTask) {
+          try {
+            fetchTask.clearFetch();
+          } catch (Exception e) {
+            LOG.debug(" Exception while clearing the Fetch task ", e);
+          }
+        }
+      }
       if (ctx != null) {
         ctx.clear();
       }
+      if (null != resStream) {
+        try {
+          ((FSDataInputStream) resStream).close();
+        } catch (Exception e) {
+          LOG.debug(" Exception while closing the resStream ", e);
+        }
+      }
     } catch (Exception e) {
       console.printError("FAILED: Hive Internal Error: " + Utilities.getNameMessage(e) +
"\n"
           + org.apache.hadoop.util.StringUtils.stringifyException(e));

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchTask.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchTask.java?rev=1063062&r1=1063061&r2=1063062&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchTask.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchTask.java Mon Jan 24 23:31:28
2011
@@ -28,13 +28,14 @@ import org.apache.hadoop.hive.conf.HiveC
 import org.apache.hadoop.hive.ql.Context;
 import org.apache.hadoop.hive.ql.DriverContext;
 import org.apache.hadoop.hive.ql.QueryPlan;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.plan.FetchWork;
 import org.apache.hadoop.hive.ql.plan.TableDesc;
 import org.apache.hadoop.hive.ql.plan.api.StageType;
 import org.apache.hadoop.hive.serde.Constants;
 import org.apache.hadoop.hive.serde2.DelimitedJSONSerDe;
-import org.apache.hadoop.hive.serde2.objectinspector.InspectableObject;
 import org.apache.hadoop.hive.serde2.SerDe;
+import org.apache.hadoop.hive.serde2.objectinspector.InspectableObject;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.util.ReflectionUtils;
@@ -163,11 +164,24 @@ public class FetchTask extends Task<Fetc
   @Override
   protected void localizeMRTmpFilesImpl(Context ctx) {
     String s = work.getTblDir();
-    if ((s != null) && ctx.isMRTmpFileURI(s))
+    if ((s != null) && ctx.isMRTmpFileURI(s)) {
       work.setTblDir(ctx.localizeMRTmpFileURI(s));
+    }
 
     ArrayList<String> ls = work.getPartDir();
-    if (ls != null) 
+    if (ls != null) {
       ctx.localizePaths(ls);
+    }
+  }
+
+  /**
+   * Clear the Fetch Operator.
+   *
+   * @throws HiveException
+   */
+  public void clearFetch() throws HiveException {
+    if (null != ftOp) {
+      ftOp.clearFetchContext();
+    }
   }
 }



Mime
View raw message