MAPREDUCE-7494. File stream leak when LineRecordReader is interrupted (#7117)
Contributed by Davin Tjong
This commit is contained in:
parent
9321e322d2
commit
78a08b3b78
Binary file not shown.
@ -302,6 +302,8 @@ public synchronized void close() throws IOException {
|
||||
try {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
} else if (fileIn != null) {
|
||||
fileIn.close();
|
||||
}
|
||||
} finally {
|
||||
if (decompressor != null) {
|
||||
|
@ -99,6 +99,7 @@ public void initialize(InputSplit genericSplit,
|
||||
MRJobConfig.INPUT_FILE_MANDATORY_PREFIX);
|
||||
fileIn = FutureIO.awaitFuture(builder.build());
|
||||
|
||||
try {
|
||||
CompressionCodec codec = new CompressionCodecFactory(job).getCodec(file);
|
||||
if (null!=codec) {
|
||||
isCompressedInput = true;
|
||||
@ -138,6 +139,10 @@ public void initialize(InputSplit genericSplit,
|
||||
start += in.readLine(new Text(), 0, maxBytesToConsume(start));
|
||||
}
|
||||
this.pos = start;
|
||||
} catch (Exception e) {
|
||||
fileIn.close();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user