|
@@ -2262,7 +2262,6 @@ public class DFSOutputStream extends FSOutputSummer
|
|
|
flushInternal(); // flush all data to Datanodes
|
|
|
// get last block before destroying the streamer
|
|
|
ExtendedBlock lastBlock = streamer.getBlock();
|
|
|
- closeThreads(false);
|
|
|
TraceScope scope = Trace.startSpan("completeFile", Sampler.NEVER);
|
|
|
try {
|
|
|
completeFile(lastBlock);
|
|
@@ -2271,7 +2270,12 @@ public class DFSOutputStream extends FSOutputSummer
|
|
|
}
|
|
|
} catch (ClosedChannelException e) {
|
|
|
} finally {
|
|
|
- setClosed();
|
|
|
+ // Failures may happen when flushing data.
|
|
|
+ // Streamers may keep waiting for the new block information.
|
|
|
+ // Thus need to force closing these threads.
|
|
|
+ // Don't need to call setClosed() because closeThreads(true)
|
|
|
+ // calls setClosed() in the finally block.
|
|
|
+ closeThreads(true);
|
|
|
}
|
|
|
}
|
|
|
|