Javadoc
By acquiring a log sequence ID, we can allow log messages to continue while
we flush the cache.
Acquire a lock so that we do not roll the log between the start and
completion of a cache-flush. Otherwise the log-seq-id for the flush will
not appear in the correct logfile.
Ensuring that flushes and log-rolls don't happen concurrently also allows
us to temporarily put a log-seq-number in lastSeqWritten against the region
being flushed that might not be the earliest in-memory log-seq-number for
that region. By the time the flush is completed or aborted and before the
cacheFlushLock is released it is ensured that lastSeqWritten again has the
oldest in-memory edit's lsn for the region that was being flushed.
In this method, by removing the entry in lastSeqWritten for the region
being flushed we ensure that the next edit inserted in this region will be
correctly recorded in
#append(HRegionInfo,byte[],WALEdit,long,HTableDescriptor) The
lsn of the earliest in-memory lsn - which is now in the memstore snapshot -
is saved temporarily in the lastSeqWritten map while the flush is active.