Richard
Richard

Reputation: 15562

How does Memstore in HBase update records?

Does HBase perform update-in-place in its Memstore. Let's say if there are multiple versions of values for the same rowkey, will HBase memstore delete old value and replace it with new value?

Upvotes: 0

Views: 1214

Answers (2)

Alex Baranau
Alex Baranau

Reputation: 31

No, it will not delete & replace existing record. It will append new keyvalues (record data) to memstore. First reason: it might be configured to keep more than one version of a cell (column) value. But even if there are more more versions of a cell in memstore than it is configured to keep, it will still append the record instead of overriding it (or removing the oldest).

However, note that in more recent version of HBase (0.92+) there's an optimization of memstore flushing process: it may skip (don't write to HFiles) those versions of the cell which are too old (i.e. should not be included given the max number of versions to keep). More on this here: HBASE-4241. Though it seem like "overriding" the existing values in Memstore (at least from the external point of view), but it is not exactly doing that. This optimization happens only upon memstore flush and hence doesn't affect the memstore size: when new values are written, they always appended. I.e. this optimization will not cause flushing to happen more rarely.

There's an ongoing work related for optimizations here, so watch for the next releases.

And yes, as Richard mentioned, you can learn more about configuring HBase Memstore here.

Upvotes: 1

Arnon Rotem-Gal-Oz
Arnon Rotem-Gal-Oz

Reputation: 25909

The memstore holds the updates just like the HFile will but it will only write to disk according to the configuration of the table (e.g. if you have set the table to only hold one version of a row only the latest will be written to disk).

There's a good explanation of how the memstore works here

Upvotes: 0

Related Questions