Class AbstractFSWAL<W extends WALProvider.WriterBase>

java.lang.Object
org.apache.hadoop.hbase.regionserver.wal.AbstractFSWAL<W>
All Implemented Interfaces:
Closeable, AutoCloseable, WALFileLengthProvider, WAL
Direct Known Subclasses:
AsyncFSWAL, FSHLog

@Private public abstract class AbstractFSWAL<W extends WALProvider.WriterBase> extends Object implements WAL
Implementation of WAL to go against FileSystem; i.e. keep WALs in HDFS. Only one WAL is ever being written at a time. When a WAL hits a configured maximum size, it is rolled. This is done internal to the implementation.

As data is flushed from the MemStore to other on-disk structures (files sorted by key, hfiles), a WAL becomes obsolete. We can let go of all the log edits/entries for a given HRegion-sequence id. A bunch of work in the below is done keeping account of these region sequence ids -- what is flushed out to hfiles, and what is yet in WAL and in memory only.

It is only practical to delete entire files. Thus, we delete an entire on-disk file F when all of the edits in F have a log-sequence-id that's older (smaller) than the most-recent flush.

To read an WAL, call WALFactory.createStreamReader(FileSystem, Path) for one way read, call WALFactory.createTailingReader(FileSystem, Path, Configuration, long) for replication where we may want to tail the active WAL file.

Failure Semantic

If an exception on append or sync, roll the WAL because the current WAL is now a lame duck; any more appends or syncs will fail also with the same original exception. If we have made successful appends to the WAL and we then are unable to sync them, our current semantic is to return error to the client that the appends failed but also to abort the current context, usually the hosting server. We need to replay the WALs.
TODO: Change this semantic. A roll of WAL may be sufficient as long as we have flagged client that the append failed.
TODO: replication may pick up these last edits though they have been marked as failed append (Need to keep our own file lengths, not rely on HDFS).