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 30e874ae58
commit 421ae2a688
1 changed files with 5 additions and 1 deletions

View File

@ -437,7 +437,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;
} }