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:51:34 GMT
Repository: tez
Updated Branches:
  refs/heads/branch-0.9 d607c948a -> 2232589ab


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

(cherry picked from commit 4496f66673de97bbe92e9b143696635038c2b799)


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

Branch: refs/heads/branch-0.9
Commit: 2232589ab97ce7d338d8a869b685048155857166
Parents: d607c94
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:49:56 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/2232589a/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/2232589a/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 dce9e52..59afcf7 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
@@ -137,7 +137,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;
       }
@@ -187,8 +187,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