protected void doSync(long txid, boolean forceSync) throws IOException {
    if (highestSyncedTxid.get() >= txid) {
      return;
    }
    // here we do not use ring buffer sequence as txid
    long sequence = waitingConsumePayloads.next();
    SyncFuture future;
    try {
      future = getSyncFuture(txid, forceSync);
      RingBufferTruck truck = waitingConsumePayloads.get(sequence);
      truck.load(future);
    } finally {
      waitingConsumePayloads.publish(sequence);
    }
    if (shouldScheduleConsumer()) {
      consumeExecutor.execute(consumer);
    }
    blockOnSync(future);
  }
Append a set of edits to the WAL.
<p/>
The WAL is not flushed/sync'd after this transaction completes BUT on return this edit must
have its region edit/sequence id assigned else it messes up our unification of mvcc and
sequenceid. On return <code>key</code> will have the region edit/sequence id filled in.
<p/>
NOTE: This appends, at a time that is usually after this call returns, starts a mvcc
transaction by calling 'begin' wherein which we assign this update a sequenceid. At assignment
time, we stamp all the passed in Cells inside WALEdit with their sequenceId. You must
'complete' the transaction this mvcc transaction by calling
MultiVersionConcurrencyControl#complete(...) or a variant otherwise mvcc will get stuck. Do it
in the finally of a try/finally block within which this appends lives and any subsequent
operations like sync or update of memstore, etc. Get the WriteEntry to pass mvcc out of the
passed in WALKey <code>walKey</code> parameter. Be warned that the WriteEntry is not
immediately available on return from this method. It WILL be available subsequent to a sync of
this append; otherwise, you will just have to wait on the WriteEntry to get filled in.
@param hri        the regioninfo associated with append
@param key        Modified by this call; we add to it this edits region edit/sequence id.
@param edits      Edits to append. MAY CONTAIN NO EDITS for case where we want to get an edit
                  sequence id that is after all currently appended edits.
@param inMemstore Always true except for case where we are writing a region event meta marker
                  edit, for example, a compaction completion record into the WAL or noting a
                  Region Open event. In these cases the entry is just so we can finish an
                  unfinished compaction after a crash when the new Server reads the WAL on
                  recovery, etc. These transition event 'Markers' do not go via the memstore.
                  When memstore is false, we presume a Marker event edit.
@return Returns a 'transaction id' and <code>key</code> will have the region edit/sequence id
        in it.
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java