Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Duplicate
-
0.21.0
-
None
-
None
-
Linux/x86-32, Java 1.6.0_15
Description
CompressionCodec gzip = new GzipCodec();
Path fnHDFS = new Path(workDir, "concat" + gzip.getDefaultExtension());
OutputStream out = localFs.create(fnHDFS);
Compressor gzCmp = gzip.createCompressor();
CompressionOutputStream gzOStm = gzip.createOutputStream(out, gzCmp);
gzOStm.write("first gzip concat\n member\nwith three lines\n".getBytes());
gzOStm.finish();
gzOStm.resetState();
gzOStm.write("2nd gzip concat member\n".getBytes());
gzOStm.finish();
gzOStm.resetState();
gzOStm.write("gzip concat\nmember #3\n".getBytes());
gzOStm.close();
This should create a 3-member concatenated gzip file (i.e., equivalent to concatenation of three individual gzip files). However, resetState() simply resets the underlying deflate engine; it does not reset the running CRC-32, nor does it set a flag to write a new gzip header. As a result, the output stream is corrupted--i.e., only the first member is readable.
I also have hex dumps, but they don't work well with proportional fonts.
Attachments
Issue Links
- duplicates
-
HADOOP-8522 ResetableGzipOutputStream creates invalid gzip files when finish() and resetState() are used
- Resolved