Support additional compression levels for GzipCodec. Contributed by Ravi Mutyala.
(cherry picked from commit18f9b77a32
) (cherry picked from commite38c2ef6c5
)
This commit is contained in:
parent
019770c769
commit
78a4c34894
|
@ -11,6 +11,9 @@ Release 2.7.3 - UNRELEASED
|
||||||
HADOOP-12413. AccessControlList should avoid calling getGroupNames in
|
HADOOP-12413. AccessControlList should avoid calling getGroupNames in
|
||||||
isUserInList with empty groups. (Zhihai Xu via cnauroth)
|
isUserInList with empty groups. (Zhihai Xu via cnauroth)
|
||||||
|
|
||||||
|
HADOOP-12794. Support additional compression levels for GzipCodec.
|
||||||
|
(Ravi Mutyala via junping_du)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HADOOP-12810. FileSystem#listLocatedStatus causes unnecessary RPC calls
|
HADOOP-12810. FileSystem#listLocatedStatus causes unnecessary RPC calls
|
||||||
|
|
|
@ -71,6 +71,46 @@ public class ZlibCompressor implements Compressor {
|
||||||
*/
|
*/
|
||||||
BEST_SPEED (1),
|
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.
|
* Compression level for best compression.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -121,6 +121,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
|
@Test
|
||||||
public void testZlibCompressDecompress() {
|
public void testZlibCompressDecompress() {
|
||||||
byte[] rawData = null;
|
byte[] rawData = null;
|
||||||
|
|
Loading…
Reference in New Issue