hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhang...@apache.org
Subject hbase git commit: HBASE-17206 FSHLog may roll a new writer successfully with unflushed entries
Date Thu, 01 Dec 2016 06:23:52 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.1 b320d4909 -> 3b0319ab0


HBASE-17206 FSHLog may roll a new writer successfully with unflushed entries


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

Branch: refs/heads/branch-1.1
Commit: 3b0319ab090ec9c6285d49022398d93759637c49
Parents: b320d49
Author: zhangduo <zhangduo@apache.org>
Authored: Wed Nov 30 21:41:29 2016 +0800
Committer: zhangduo <zhangduo@apache.org>
Committed: Thu Dec 1 14:06:44 2016 +0800

----------------------------------------------------------------------
 .../hadoop/hbase/regionserver/wal/FSHLog.java     | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/3b0319ab/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
index b229283..2523215 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
@@ -1919,6 +1919,12 @@ public class FSHLog implements WAL {
      */
     private volatile CountDownLatch safePointReleasedLatch = new CountDownLatch(1);
 
+    private void checkIfSyncFailed(SyncFuture syncFuture) throws FailedSyncBeforeLogCloseException
{
+      if (syncFuture.isThrowable()) {
+        throw new FailedSyncBeforeLogCloseException(syncFuture.getThrowable());
+      }
+    }
+
     /**
      * For Thread A to call when it is ready to wait on the 'safe point' to be attained.
      * Thread A will be held in here until Thread B calls {@link #safePointAttained()}
@@ -1929,14 +1935,12 @@ public class FSHLog implements WAL {
      * @return The passed <code>syncFuture</code>
      * @throws FailedSyncBeforeLogCloseException
      */
-    SyncFuture waitSafePoint(final SyncFuture syncFuture)
-    throws InterruptedException, FailedSyncBeforeLogCloseException {
-      while (true) {
-        if (this.safePointAttainedLatch.await(1, TimeUnit.NANOSECONDS)) break;
-        if (syncFuture.isThrowable()) {
-          throw new FailedSyncBeforeLogCloseException(syncFuture.getThrowable());
-        }
+    SyncFuture waitSafePoint(SyncFuture syncFuture) throws InterruptedException,
+        FailedSyncBeforeLogCloseException {
+      while (!this.safePointAttainedLatch.await(1, TimeUnit.MILLISECONDS)) {
+        checkIfSyncFailed(syncFuture);
       }
+      checkIfSyncFailed(syncFuture);
       return syncFuture;
     }
 


Mime
View raw message