- All Implemented Interfaces:
- HeapSize
@InterfaceAudience.LimitedPrivate(value={"Replication","Coprocesssor"})
public class WALEdit
extends Object
implements HeapSize
WALEdit: Used in HBase's transaction log (WAL) to represent
the collection of edits (KeyValue objects) corresponding to a
single transaction. The class implements "Writable" interface
for serializing/deserializing a set of KeyValue items.
Previously, if a transaction contains 3 edits to c1, c2, c3 for a row R,
the WAL would have three log entries as follows:
:
:
:
This presents problems because row level atomicity of transactions
was not guaranteed. If we crash after few of the above appends make
it, then recovery will restore a partial transaction.
In the new world, all the edits for a given transaction are written
out as a single record, for example:
:
where, the WALEdit is serialized as:
<-1, # of edits, , , ... >
For example:
<-1, 3, , , >
The -1 marker is just a special way of being backward compatible with
an old WAL which would have contained a single .
The deserializer for WALEdit backward compatibly detects if the record
is an old style KeyValue or the new style WALEdit.