Database Reference
In-Depth Information
4. After the log replay is done, all the MemTables are force flushed to a disk, and all
the commit log segments are recycled.
MemTable
MemTable is an in-memory representation of a column family. It can be thought of as
cached data. MemTable is sorted by key. Data in MemTable is sorted by row key. Unlike
the commit log, which is append-only, MemTable does not contain duplicates. A new
write with a key that already exists in the MemTable, overwrites the older record. This be-
ing in memory is both fast and efficient. The following is an example:
Write 1: {k1: [{c1, v1}, {c2, v2}, {c3, v3}]}
In CommitLog (new entry, append):
{k1: [{c1, v1},{c2, v2}, {c3, v3}]}
In MemTable (new entry, append):
{k1: [{c1, v1}, {c2, v2}, {c3, v3}]}
Write 2: {k2: [{c4, v4}]}
In CommitLog (new entry, append):
{k1: [{c1, v1}, {c2, v2}, {c3, v3}]}
{k2: [{c4, v4}]}
In MemTable (new entry, append):
{k1: [{c1, v1}, {c2, v2}, {c3, v3}]}
{k2: [{c4, v4}]}
Write 3: {k1: [{c1, v5}, {c6, v6}]}
In CommitLog (old entry, append):
{k1: [{c1, v1}, {c2, v2}, {c3, v3}]}
{k2: [{c4, v4}]}
{k1: [{c1, v5}, {c6, v6}]}
In MemTable (old entry, update):
{k1: [{c1, v5}, {c2, v2}, {c3, v3}, {c6, v6}]}
{k2: [{c4, v4}]}
Search WWH ::




Custom Search