You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2017/11/29 02:20:37 UTC

hbase git commit: HBASE-17049 Do not issue sync request when there are still entries in ringbuffer

Repository: hbase
Updated Branches:
  refs/heads/master f6582400b -> 93b91e2cc


HBASE-17049 Do not issue sync request when there are still entries in ringbuffer


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

Branch: refs/heads/master
Commit: 93b91e2cc69d7d8a8175b0059d92543929b0eabb
Parents: f658240
Author: zhangduo <zh...@apache.org>
Authored: Fri Nov 24 21:26:30 2017 +0800
Committer: zhangduo <zh...@apache.org>
Committed: Wed Nov 29 10:19:42 2017 +0800

----------------------------------------------------------------------
 .../hadoop/hbase/regionserver/wal/AsyncFSWAL.java   | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/93b91e2c/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AsyncFSWAL.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AsyncFSWAL.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AsyncFSWAL.java
index d4e113a..9baf803 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AsyncFSWAL.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AsyncFSWAL.java
@@ -463,12 +463,10 @@ public class AsyncFSWAL extends AbstractFSWAL<AsyncWriter> {
       }
       return;
     }
-    // we have some unsynced data but haven't reached the batch size yet
-    if (!syncFutures.isEmpty()
-        && syncFutures.last().getTxid() > highestProcessedAppendTxidAtLastSync) {
-      // we have at least one sync request
-      sync(writer);
-    }
+    // reach here means that we have some unsynced data but haven't reached the batch size yet
+    // but we will not issue a sync directly here even if there are sync requests because we may
+    // have some new data in the ringbuffer, so let's just return here and delay the decision of
+    // whether to issue a sync in the caller method.
   }
 
   private void consume() {
@@ -526,6 +524,12 @@ public class AsyncFSWAL extends AbstractFSWAL<AsyncWriter> {
         // give up scheduling the consumer task.
         // 3. we set consumerScheduled to false and also give up scheduling consumer task.
         if (waitingConsumePayloadsGatingSequence.get() == waitingConsumePayloads.getCursor()) {
+          // we will give up consuming so if there are some unsynced data we need to issue a sync.
+          if (writer.getLength() > fileLengthAtLastSync && !syncFutures.isEmpty() &&
+              syncFutures.last().getTxid() > highestProcessedAppendTxidAtLastSync) {
+            // no new data in the ringbuffer and we have at least one sync request
+            sync(writer);
+          }
           return;
         } else {
           // maybe someone has grabbed this before us