memstore flush WAL record is removed.
Previously, there existed cacheFlushLock which was used for 4 distinct purposes:
1) Make sure the WAL record for memstore flush ends up in the same WAL that was active when the flush started. In other words, log rolling is prevented during memstore flush.
2) Make sure only one log rolling operation happens at a time.
3) Control access to "lastSeqWritten" map for any operation that is not covered by SynchronizedMap.
4) Make sure that close() waits for all the flushes and rolls, by virtue of doing work under this lock and setting .closed = true for potential future callers.
Nothing prevented startCacheFlush from proceeding after close is done, since it doesn't perform the check of closed.
cacheFlushLock was replaced by more granular/appropriate locking:
1) No longer needed/relevant, in fact there's
HBASE-7011 to get rid of this too.
2) rollWriter is made "synchronized".
3) Control of the map is under its own small-scope lock.
4) Added a simple barrier class to be able to block close on outstanding operations, and drain existing ones.