HDFS-12358. Handle IOException when transferring edit log to Journal current dir through JN sync. Contributed by Hanisha Koneru.
This commit is contained in:
parent
bb6a3c8330
commit
077a5eed9f
|
@ -403,20 +403,23 @@ public class JournalNodeSyncer {
|
||||||
LOG.info("Downloaded file " + tmpEditsFile.getName() + " of size " +
|
LOG.info("Downloaded file " + tmpEditsFile.getName() + " of size " +
|
||||||
tmpEditsFile.length() + " bytes.");
|
tmpEditsFile.length() + " bytes.");
|
||||||
|
|
||||||
final boolean moveSuccess = journal.moveTmpSegmentToCurrent(tmpEditsFile,
|
boolean moveSuccess = false;
|
||||||
finalEditsFile, log.getEndTxId());
|
try {
|
||||||
if (!moveSuccess) {
|
moveSuccess = journal.moveTmpSegmentToCurrent(tmpEditsFile,
|
||||||
// If move is not successful, delete the tmpFile
|
finalEditsFile, log.getEndTxId());
|
||||||
LOG.debug("Move to current directory unsuccessful. Deleting temporary " +
|
} catch (IOException e) {
|
||||||
"file: " + tmpEditsFile);
|
LOG.info("Could not move %s to current directory.", tmpEditsFile);
|
||||||
if (!tmpEditsFile.delete()) {
|
} finally {
|
||||||
|
if (tmpEditsFile.exists() && !tmpEditsFile.delete()) {
|
||||||
LOG.warn("Deleting " + tmpEditsFile + " has failed");
|
LOG.warn("Deleting " + tmpEditsFile + " has failed");
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
metrics.incrNumEditLogsSynced();
|
|
||||||
}
|
}
|
||||||
return true;
|
if (moveSuccess) {
|
||||||
|
metrics.incrNumEditLogsSynced();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static DataTransferThrottler getThrottler(Configuration conf) {
|
private static DataTransferThrottler getThrottler(Configuration conf) {
|
||||||
|
|
Loading…
Reference in New Issue