You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by je...@apache.org on 2014/06/03 02:51:18 UTC

git commit: HBASE-10922: Log splitting status should always be closed

Repository: hbase
Updated Branches:
  refs/heads/master 57826c7da -> 7465c3194


HBASE-10922: Log splitting status should always be closed


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7465c319
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7465c319
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7465c319

Branch: refs/heads/master
Commit: 7465c319472dfb3c98474369cdc15514eeea6293
Parents: 57826c7
Author: Jeffrey Zhong <jz...@JZhongs-MacBook-Pro.local>
Authored: Mon Jun 2 17:56:15 2014 -0700
Committer: Jeffrey Zhong <jz...@JZhongs-MacBook-Pro.local>
Committed: Mon Jun 2 17:56:15 2014 -0700

----------------------------------------------------------------------
 .../hbase/regionserver/wal/HLogSplitter.java    | 30 ++++++++++++--------
 1 file changed, 18 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/7465c319/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java
index 22adaf9..00e9f15 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java
@@ -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;
-      }
-      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);
+      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);
+      }
     }
     return !progress_failed;
   }