protected FlushResultImpl internalFlushcache(WAL wal, long myseqid,
    Collection<HStore> storesToFlush, MonitoredTask status, boolean writeFlushWalMarker,
    FlushLifeCycleTracker tracker) throws IOException {
    PrepareFlushResult result =
      internalPrepareFlushCache(wal, myseqid, storesToFlush, status, writeFlushWalMarker, tracker);
    if (result.result == null) {
      return internalFlushCacheAndCommit(wal, status, result, storesToFlush);
    } else {
      return result.result; // early exit due to failure from prepare stage
    }
  }
Flush the memstore. Flushing the memstore is a little tricky. We have a lot of updates in the
memstore, all of which have also been written to the wal. We need to write those updates in the
memstore out to disk, while being able to process reads/writes as much as possible during the
flush operation.
<p>
This method may block for some time. Every time you call it, we up the regions sequence id even
if we don't flush; i.e. the returned region id will be at least one larger than the last edit
applied to this region. The returned id does not refer to an actual edit. The returned id can
be used for say installing a bulk loaded file just ahead of the last hfile that was the result
of this flush, etc.
@param wal           Null if we're NOT to go via wal.
@param myseqid       The seqid to use if <code>wal</code> is null writing out flush file.
@param storesToFlush The list of stores to flush.
@return object describing the flush's state
@throws IOException              general io exceptions
@throws DroppedSnapshotException Thrown when replay of WAL is required.
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java