|
@@ -282,6 +282,7 @@ public class DFSStripedOutputStream extends DFSOutputStream
|
|
|
private ExecutorService flushAllExecutor;
|
|
|
private CompletionService<Void> flushAllExecutorCompletionService;
|
|
|
private int blockGroupIndex;
|
|
|
+ private long datanodeRestartTimeout;
|
|
|
|
|
|
/** Construct a new output stream for creating a file. */
|
|
|
DFSStripedOutputStream(DFSClient dfsClient, String src, HdfsFileStatus stat,
|
|
@@ -321,6 +322,7 @@ public class DFSStripedOutputStream extends DFSOutputStream
|
|
|
streamers.add(streamer);
|
|
|
}
|
|
|
currentPackets = new DFSPacket[streamers.size()];
|
|
|
+ datanodeRestartTimeout = dfsClient.getConf().getDatanodeRestartTimeout();
|
|
|
setCurrentStreamer(0);
|
|
|
}
|
|
|
|
|
@@ -621,6 +623,11 @@ public class DFSStripedOutputStream extends DFSOutputStream
|
|
|
"streamer: " + streamer);
|
|
|
streamer.setExternalError();
|
|
|
healthySet.add(streamer);
|
|
|
+ } else if (!streamer.streamerClosed()
|
|
|
+ && streamer.getErrorState().hasDatanodeError()
|
|
|
+ && streamer.getErrorState().doWaitForRestart()) {
|
|
|
+ healthySet.add(streamer);
|
|
|
+ failedStreamers.remove(streamer);
|
|
|
}
|
|
|
}
|
|
|
return healthySet;
|
|
@@ -685,6 +692,14 @@ public class DFSStripedOutputStream extends DFSOutputStream
|
|
|
for (int i = 0; i < numAllBlocks; i++) {
|
|
|
coordinator.offerStreamerUpdateResult(i, newFailed.size() == 0);
|
|
|
}
|
|
|
+ //wait for get notify to failed stream
|
|
|
+ if (newFailed.size() != 0) {
|
|
|
+ try {
|
|
|
+ Thread.sleep(datanodeRestartTimeout);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ // Do nothing
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|