From 3eda33a0489c27627df790dea559511e3c6c7a61 Mon Sep 17 00:00:00 2001 From: Duo Zhang Date: Sat, 13 Jul 2019 22:11:39 +0800 Subject: [PATCH] HBASE-22681 The 'assert highestUnsyncedTxid < entry.getTxid();' in AbstractFWAL.append may fail when using AsyncFSWAL (#376) Signed-off-by: Zheng Hu --- .../apache/hadoop/hbase/regionserver/wal/AsyncFSWAL.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 0fe67f6de11..8482809df63 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 @@ -439,7 +439,11 @@ public class AsyncFSWAL extends AbstractFSWAL { newHighestProcessedAppendTxid = entry.getTxid(); iter.remove(); if (appended) { - unackedAppends.addLast(entry); + // This is possible, when we fail to sync, we will add the unackedAppends back to + // toWriteAppends, so here we may get an entry which is already in the unackedAppends. + if (unackedAppends.isEmpty() || unackedAppends.peekLast().getTxid() < entry.getTxid()) { + unackedAppends.addLast(entry); + } if (writer.getLength() - fileLengthAtLastSync >= batchSize) { break; }