MAPREDUCE-2258. IFile reader closes stream and compressor in wrong order. Contributed by Todd Lipcon.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/mapreduce/trunk@1124383 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES.txt b/CHANGES.txt
index 269dcba..afc051a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -193,6 +193,9 @@
MAPREDUCE-2467. HDFS-1052 changes break the raid contrib module in
MapReduce. (suresh srinivas via mahadev)
+ MAPREDUCE-2258. IFile reader closes stream and compressor in wrong order.
+ (todd via tomwhite)
+
Release 0.22.0 - Unreleased
INCOMPATIBLE CHANGES
diff --git a/src/java/org/apache/hadoop/mapred/IFile.java b/src/java/org/apache/hadoop/mapred/IFile.java
index 56823c5..57e74df 100644
--- a/src/java/org/apache/hadoop/mapred/IFile.java
+++ b/src/java/org/apache/hadoop/mapred/IFile.java
@@ -453,13 +453,6 @@
}
public void close() throws IOException {
- // Return the decompressor
- if (decompressor != null) {
- decompressor.reset();
- CodecPool.returnDecompressor(decompressor);
- decompressor = null;
- }
-
// Close the underlying stream
in.close();
@@ -469,6 +462,13 @@
if(readRecordsCounter != null) {
readRecordsCounter.increment(numRecordsRead);
}
+
+ // Return the decompressor
+ if (decompressor != null) {
+ decompressor.reset();
+ CodecPool.returnDecompressor(decompressor);
+ decompressor = null;
+ }
}
public void reset(int offset) {