hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From junping...@apache.org
Subject hadoop git commit: Support additional compression levels for GzipCodec. Contributed by Ravi Mutyala. (cherry picked from commit 18f9b77a321b225677ce23c503b41d21478fc4a7) (cherry picked from commit e38c2ef6c54521a74cc2b787d78211f629aa07d8)
Date Fri, 19 Feb 2016 22:23:08 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.7 019770c76 -> 78a4c3489


Support additional compression levels for GzipCodec. Contributed by Ravi Mutyala.
(cherry picked from commit 18f9b77a321b225677ce23c503b41d21478fc4a7)
(cherry picked from commit e38c2ef6c54521a74cc2b787d78211f629aa07d8)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/78a4c348
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/78a4c348
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/78a4c348

Branch: refs/heads/branch-2.7
Commit: 78a4c348940cd98548650c0a5adb981895cef201
Parents: 019770c
Author: Junping Du <junping_du@apache.org>
Authored: Fri Feb 19 14:21:25 2016 -0800
Committer: Junping Du <junping_du@apache.org>
Committed: Fri Feb 19 14:26:53 2016 -0800

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt |  3 ++
 .../hadoop/io/compress/zlib/ZlibCompressor.java | 42 +++++++++++++++++++-
 .../zlib/TestZlibCompressorDecompressor.java    | 25 ++++++++++++
 3 files changed, 69 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/78a4c348/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index cb10059..d5bf275 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -11,6 +11,9 @@ Release 2.7.3 - UNRELEASED
     HADOOP-12413. AccessControlList should avoid calling getGroupNames in
     isUserInList with empty groups. (Zhihai Xu via cnauroth)
 
+    HADOOP-12794. Support additional compression levels for GzipCodec.
+    (Ravi Mutyala via junping_du)
+
   OPTIMIZATIONS
 
     HADOOP-12810. FileSystem#listLocatedStatus causes unnecessary RPC calls

http://git-wip-us.apache.org/repos/asf/hadoop/blob/78a4c348/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/zlib/ZlibCompressor.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/zlib/ZlibCompressor.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/zlib/ZlibCompressor.java
index 6799403..96873b1 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/zlib/ZlibCompressor.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/zlib/ZlibCompressor.java
@@ -70,7 +70,47 @@ public class ZlibCompressor implements Compressor {
      * Compression level for fastest compression.
      */
     BEST_SPEED (1),
-    
+
+    /**
+     * Compression level 2.
+     */
+    TWO (2),
+
+
+    /**
+     * Compression level 3.
+     */
+    THREE (3),
+
+
+    /**
+     * Compression level 4.
+     */
+    FOUR (4),
+
+
+    /**
+     * Compression level 5.
+     */
+    FIVE (5),
+
+
+    /**
+     * Compression level 6.
+     */
+    SIX (6),
+
+    /**
+     * Compression level 7.
+     */
+    SEVEN (7),
+
+    /**
+     * Compression level 8.
+     */
+    EIGHT (8),
+
+
     /**
      * Compression level for best compression.
      */

http://git-wip-us.apache.org/repos/asf/hadoop/blob/78a4c348/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/compress/zlib/TestZlibCompressorDecompressor.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/compress/zlib/TestZlibCompressorDecompressor.java
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/compress/zlib/TestZlibCompressorDecompressor.java
index db5784c..f2e07b0 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/compress/zlib/TestZlibCompressorDecompressor.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/compress/zlib/TestZlibCompressorDecompressor.java
@@ -122,6 +122,31 @@ public class TestZlibCompressorDecompressor {
   }
 
   @Test
+  public void testZlibCompressorDecompressorWithCompressionLevels() {
+    Configuration conf = new Configuration();
+    conf.set("zlib.compress.level","FOUR");
+    if (ZlibFactory.isNativeZlibLoaded(conf)) {
+      byte[] rawData;
+      int tryNumber = 5;
+      int BYTE_SIZE = 10 * 1024;
+      Compressor zlibCompressor = ZlibFactory.getZlibCompressor(conf);
+      Decompressor zlibDecompressor = ZlibFactory.getZlibDecompressor(conf);
+      rawData = generate(BYTE_SIZE);
+      try {
+        for (int i = 0; i < tryNumber; i++)
+          compressDecompressZlib(rawData, (ZlibCompressor) zlibCompressor,
+                  (ZlibDecompressor) zlibDecompressor);
+        zlibCompressor.reinit(conf);
+      } catch (Exception ex) {
+        fail("testZlibCompressorDecompressorWithConfiguration ex error " + ex);
+      }
+    } else {
+      assertTrue("ZlibFactory is using native libs against request",
+              ZlibFactory.isNativeZlibLoaded(conf));
+    }
+  }
+
+  @Test
   public void testZlibCompressDecompress() {
     byte[] rawData = null;
     int rawDataSize = 0;


Mime
View raw message