Repository: hbase Updated Branches: refs/heads/branch-2 e946d9d84 -> 8688da9e9
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/8688da9e Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/8688da9e Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/8688da9e Branch: refs/heads/branch-2 Commit: 8688da9e9c4b54d5ccd22bc10eab5ac873325522 Parents: e946d9d Author: zhangduo <zhang...@apache.org> Authored: Fri Nov 24 21:26:30 2017 +0800 Committer: zhangduo <zhang...@apache.org> Committed: Wed Nov 29 10:19:53 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/8688da9e/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