HBASE-22681 The 'assert highestUnsyncedTxid < entry.getTxid();' in AbstractFWAL.append may fail when using AsyncFSWAL (#376)

Signed-off-by: Zheng Hu <openinx@gmail.com>
This commit is contained in:
Duo Zhang 2019-07-13 22:11:39 +08:00
parent b6e66699a9
commit 3eda33a048
1 changed files with 5 additions and 1 deletions

View File

@ -439,7 +439,11 @@ public class AsyncFSWAL extends AbstractFSWAL<AsyncWriter> {
newHighestProcessedAppendTxid = entry.getTxid(); newHighestProcessedAppendTxid = entry.getTxid();
iter.remove(); iter.remove();
if (appended) { 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) { if (writer.getLength() - fileLengthAtLastSync >= batchSize) {
break; break;
} }