tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jl...@apache.org
Subject tez git commit: TEZ-3964. Inflater not closed in some places (Jaume M via jlowe)
Date Thu, 12 Jul 2018 15:49:19 GMT
Repository: tez
Updated Branches:
  refs/heads/master 919d328af -> 4496f6667


TEZ-3964. Inflater not closed in some places (Jaume M via jlowe)


Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/4496f666
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/4496f666
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/4496f666

Branch: refs/heads/master
Commit: 4496f66673de97bbe92e9b143696635038c2b799
Parents: 919d328
Author: Jason Lowe <jlowe@apache.org>
Authored: Thu Jul 12 10:48:07 2018 -0500
Committer: Jason Lowe <jlowe@apache.org>
Committed: Thu Jul 12 10:48:07 2018 -0500

----------------------------------------------------------------------
 .../org/apache/tez/common/TezCommonUtils.java   |  7 ++++++-
 .../apache/tez/dag/history/utils/DAGUtils.java  | 20 ++++++++++++++++++--
 2 files changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/4496f666/tez-api/src/main/java/org/apache/tez/common/TezCommonUtils.java
----------------------------------------------------------------------
diff --git a/tez-api/src/main/java/org/apache/tez/common/TezCommonUtils.java b/tez-api/src/main/java/org/apache/tez/common/TezCommonUtils.java
index c8e8e02..16165e2 100644
--- a/tez-api/src/main/java/org/apache/tez/common/TezCommonUtils.java
+++ b/tez-api/src/main/java/org/apache/tez/common/TezCommonUtils.java
@@ -388,7 +388,12 @@ public class TezCommonUtils {
 
   @Private
   public static byte[] decompressByteStringToByteArray(ByteString byteString) throws IOException
{
-    return decompressByteStringToByteArray(byteString, newInflater());
+    Inflater inflater = newInflater();
+    try {
+      return decompressByteStringToByteArray(byteString, inflater);
+    } finally {
+      inflater.end();
+    }
   }
 
   @Private

http://git-wip-us.apache.org/repos/asf/tez/blob/4496f666/tez-dag/src/main/java/org/apache/tez/dag/history/utils/DAGUtils.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/history/utils/DAGUtils.java b/tez-dag/src/main/java/org/apache/tez/dag/history/utils/DAGUtils.java
index b2622ad..77d3447 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/history/utils/DAGUtils.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/history/utils/DAGUtils.java
@@ -139,7 +139,7 @@ public class DAGUtils {
   }
 
   public static Map<String,Object> convertCountersToATSMap(TezCounters counters) {
-    Map<String,Object> object = new LinkedHashMap<String, Object>();
+    Map<String, Object> object = new LinkedHashMap<String, Object>();
     if (counters == null) {
         return object;
       }
@@ -198,8 +198,24 @@ public class DAGUtils {
     return dagInfo;
   }
 
-  public static Map<String,Object> convertDAGPlanToATSMap(DAGPlan dagPlan) throws IOException
{
+  public static Map<String, Object> convertDAGPlanToATSMap(final DAGPlan
+      dagPlan) throws IOException {
     final Inflater inflater = TezCommonUtils.newInflater();
+    try {
+      return convertDAGPlanToATSMap(dagPlan, inflater);
+    } finally {
+      inflater.end();
+    }
+  }
+
+  /**
+   * Auxiliary method to convert dagPlan to ATS Map.
+   * @param dagPlan dag plan.
+   * @param inflater inflater. This method shouldn't end it.
+   * @return ATS MAP
+   */
+  private static Map<String, Object> convertDAGPlanToATSMap(DAGPlan dagPlan,
+      final Inflater inflater) {
     final String VERSION_KEY = "version";
     final int version = 2;
     Map<String,Object> dagMap = new LinkedHashMap<String, Object>();


Mime
View raw message