Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does HBase guarantee row level atomicity?

Considering the fact that HBase stores each column family in a separate HFile and the fact that a row can span many Column Families. How does HBase ensure that a put/delete operation on a row that spans multiple column families is indeed atomic ?

like image 602
arun_suresh Avatar asked Jul 31 '11 09:07

arun_suresh


People also ask

Does HBase support acid properties?

Apache HBase (TM) is not an ACID compliant database.

Why is HBase column family?

An HBase table is made of column families which are the logical and physical grouping of columns. The columns in one family are stored separately from the columns in another family. If you have data that is not often queried, assign that data to a separate column family.

How many columns can HBase have?

Technically, HBase can manage more than three of four column families. However, you need to understand how column families work to make the best use of them.

What is column key in HBase?

An HBase column includes two components: a column family and a column qualifier. These components are delimited by a colon : character, <column-family>:<column-qualifier>. An HBase row consists of a row key and one or more column values. A row key is a unique identifier for the table row.


2 Answers

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.

like image 144
cftarnas Avatar answered Sep 30 '22 11:09

cftarnas


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.

like image 43
mikhail_b Avatar answered Sep 30 '22 12:09

mikhail_b