How does HBase guarantee row level atomicity? How does HBase guarantee row level atomicity? hadoop hadoop

How does HBase guarantee row level atomicity?


All writes to the a row, no matter how many column families might be in that row, go to one regionserver, and that regionserver then writes the edit to the regions WAL (Hlog), then the writes are sync'd, then the data is added to the memstore so it will be served. Then - once the memstore has hit its limit - the memstore be flushed to disk. If any problems occur to the regionserver and it crashes/dies/has the plug pulled the WAL can be run through to keep everything consistant. For more gory details see the HBASE-2283 and Hbase Architecture 101.


HBase currently achieves row-level atomicity in spite of writing multiple HFiles by flushing all column families at the same time. The flush is triggered when the biggest column family reaches the configured flush size. There is an additional MemStore-level timestamp that allows to do multi-version concurrency control for MemStore reads, but that does not exist for key/values that are written to HFiles. Switching to per-column-family flush (a desirable feature for improving efficiency) would require a similar timestamp to be added to the file format as well.