HBASE-10922: Log splitting status should always be closed

This commit is contained in:
Jeffrey Zhong 2014-06-02 17:56:15 -07:00
parent 57826c7da9
commit 7465c31947
1 changed files with 17 additions and 11 deletions

View File

@ -269,10 +269,10 @@ public class HLogSplitter {
int editsCount = 0;
int editsSkipped = 0;
status =
TaskMonitor.get().createStatus(
"Splitting log file " + logfile.getPath() + "into a temporary staging area.");
try {
status = TaskMonitor.get().createStatus(
"Splitting log file " + logfile.getPath() +
"into a temporary staging area.");
long logLength = logfile.getLen();
LOG.info("Splitting hlog: " + logPath + ", length=" + logLength);
LOG.info("DistributedLogReplay = " + this.distributedLogReplay);
@ -290,7 +290,6 @@ public class HLogSplitter {
isCorrupted = true;
}
if (in == null) {
status.markComplete("Was nothing to split in log file");
LOG.warn("Nothing to split in log file " + logPath);
return true;
}
@ -364,14 +363,21 @@ public class HLogSplitter {
throw e;
} finally {
LOG.debug("Finishing writing output logs and closing down.");
if (outputSinkStarted) {
progress_failed = outputSink.finishWritingAndClose() == null;
try {
if (outputSinkStarted) {
// Set progress_failed to true as the immediate following statement will reset its value
// when finishWritingAndClose() throws exception, progress_failed has the right value
progress_failed = true;
progress_failed = outputSink.finishWritingAndClose() == null;
}
} finally {
String msg =
"Processed " + editsCount + " edits across " + outputSink.getNumberOfRecoveredRegions()
+ " regions; log file=" + logPath + " is corrupted = " + isCorrupted
+ " progress failed = " + progress_failed;
LOG.info(msg);
status.markComplete(msg);
}
String msg = "Processed " + editsCount + " edits across "
+ outputSink.getNumberOfRecoveredRegions() + " regions; log file=" + logPath
+ " is corrupted = " + isCorrupted + " progress failed = " + progress_failed;
LOG.info(msg);
status.markComplete(msg);
}
return !progress_failed;
}