@Override
    public WAL.Entry filter(WAL.Entry entry) {
      filteredWALEntryCount++;
      if (filteredWALEntryCount < walEntryCount - 1) {
        return entry;
      }

      filteredWALEntryCount = -1;
      throwExceptionCount++;
      if (throwExceptionCount <= maxThrowExceptionCount - 1) {
        throw new WALEntryFilterRetryableException("failing filter");
      }
      return entry;
    }
This test is for HBASE-27778, when {@link WALEntryFilter#filter} throws exception for some
entries in {@link WALEntryBatch},{@link ReplicationSourceWALReader#totalBufferUsed} should be
decreased because {@link WALEntryBatch} is not put to
{@link ReplicationSourceWALReader#entryBatchQueue}.
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestBasicWALEntryStream.java