I wrote in more detail about HDFS' flush and sync semantics here: here. Also check out HDFS-744 and HBASE-5954.
Recently I got back to this area in the code and committed HBASE-7801 to HBase 0.94.7+, which streamlines the durability API for the HBase client.
The existing API was a mess, with some settings configured only via the table on the server (such as deferred log flush) and some only via the client per each Mutation (i.e. Put or Delete) such as Mutation.setWriteToWAL(...). In addition some table settings could be overridden by a client and some could not.
HBASE-7801 includes the necessary changes on both server and client to support a new API: Mutation.setDurablity(Durability).
A client can now control durability per Mutation - via passing a Durability Enum - as follows:
- USE_DEFAULT: do whatever the default is for the table. This is the client default.
- SKIP_WAL: do not write to the WAL
- ASYNC_WAL: write to the WAL asynchronously as soon as possible
- SYNC_WAL: write WAL synchronously
- FSYNC_WAL: write to the WAL synchronously and guarantee that the edit is on disk (not currently supported)
The changes are backward compatible. A server prior to 0.94.7 will gracefully ignore any client settings that it does not support.
The HTable.setWriteToWAL(boolean) API is deprecated in 0.94.7+ and was removed in 0.95+.
I filed a followup jira to do the same refactoring the table descriptors HBASE-8375.