@InterfaceAudience.LimitedPrivate(value={"Replication","Coprocesssor"})
public class WALEdit
extends Object
implements HeapSize
This class is LimitedPrivate for CPs to read-only. The add(org.apache.hadoop.hbase.Cell, byte[]) methods are classified as
private methods, not for use by CPs.
A particular WALEdit 'type' is the 'meta' type used to mark key operational events in the WAL
such as compaction, flush, or region open. These meta types do not traverse hbase memstores. They
are edits made by the hbase system rather than edit data submitted by clients. They only show in
the WAL. These 'Meta' types have not been formally specified (or made into an explicit class
type). They evolved organically. HBASE-8457 suggests codifying a WALEdit 'type' by adding a type
field to WALEdit that gets serialized into the WAL. TODO. Would have to work on the
consumption-side. Reading WALs on replay we seem to consume a Cell-at-a-time rather than by
WALEdit. We are already in the below going out of our way to figure particular types -- e.g. if a
compaction, replay, or close meta Marker -- during normal processing so would make sense to do
this. Current system is an awkward marking of Cell columnfamily as METAFAMILY and then
setting qualifier based off meta edit type. For replay-time where we read Cell-at-a-time, there
are utility methods below for figuring meta type. See also
createBulkLoadEvent(RegionInfo, WALProtos.BulkLoadDescriptor), etc., for where we create
meta WALEdit instances.
WALEdit will accumulate a Set of all column family names referenced by the Cells
add(Cell)'d. This is an optimization. Usually when loading a WALEdit, we have the column
family name to-hand.. just shove it into the WALEdit if available. Doing this, we can save on a
parse of each Cell to figure column family down the line when we go to add the WALEdit to the WAL
file. See the hand-off in FSWALEntry Constructor.
WALKey| Modifier and Type | Field and Description |
|---|---|
static byte[] |
BULK_LOAD |
static byte[] |
COMPACTION
Deprecated.
Since 2.3.0. Make it protected, internal-use only. Use
isCompactionMarker(Cell) |
static byte[] |
FLUSH
Deprecated.
Since 2.3.0. Make it protected, internal-use only.
|
static byte[] |
METAFAMILY |
static byte[] |
METAROW
Deprecated.
Since 2.3.0. Not used.
|
static byte[] |
REGION_EVENT
Deprecated.
Since 2.3.0. Remove. Not for external use. Not used.
|
| Constructor and Description |
|---|
WALEdit() |
WALEdit(boolean replay)
Deprecated.
since 2.0.1 and will be removed in 4.0.0. Use
WALEdit(int, boolean)
instead. |
WALEdit(int cellCount)
Deprecated.
since 2.0.1 and will be removed in 4.0.0. Use
WALEdit(int, boolean)
instead. |
WALEdit(int cellCount,
boolean isReplay) |
public static final byte[] METAFAMILY
@Deprecated public static final byte[] METAROW
@Deprecated @InterfaceAudience.Private public static final byte[] COMPACTION
isCompactionMarker(Cell)@Deprecated @InterfaceAudience.Private public static final byte[] FLUSH
@Deprecated public static final byte[] REGION_EVENT
@InterfaceAudience.Private public static final byte[] BULK_LOAD
public WALEdit()
@Deprecated public WALEdit(boolean replay)
WALEdit(int, boolean)
instead.WALEdit(int, boolean),
HBASE-20781@Deprecated public WALEdit(int cellCount)
WALEdit(int, boolean)
instead.WALEdit(int, boolean),
HBASE-20781public WALEdit(int cellCount,
boolean isReplay)
cellCount - Pass so can pre-size the WALEdit. Optimization.public Set<byte[]> getFamilies()
getCells(); may be null.@Deprecated public static boolean isMetaEditFamily(byte[] f)
f is METAFAMILYpublic static boolean isMetaEditFamily(Cell cell)
public boolean isMetaEdit()
METAFAMILY.public boolean isReplay()
public boolean isEmpty()
public int size()
@InterfaceAudience.Private public void setCells(ArrayList<Cell> cells)
cells - the list of cells that this WALEdit now contains.public int readFromCells(Codec.Decoder cellDecoder, int expectedCount) throws IOException
cellDecoder - Cell decoder.expectedCount - Expected cell count.IOExceptionpublic long estimatedSerializedSizeOf()
public static WALEdit createFlushWALEdit(RegionInfo hri, org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.FlushDescriptor f)
public static org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.FlushDescriptor getFlushDescriptor(Cell cell) throws IOException
IOExceptionpublic static WALEdit createRegionEventWALEdit(RegionInfo hri, org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.RegionEventDescriptor regionEventDesc)
regionEventDesc serialized and whose row is this region, columnfamily is
METAFAMILY and qualifier is REGION_EVENT_PREFIX +
WALProtos.RegionEventDescriptor.getEventType(); for example
HBASE::REGION_EVENT::REGION_CLOSE.@InterfaceAudience.Private public static WALEdit createRegionEventWALEdit(byte[] rowForRegion, org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.RegionEventDescriptor regionEventDesc)
@InterfaceAudience.Private public static byte[] createRegionEventDescriptorQualifier(org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.RegionEventDescriptor.EventType t)
public boolean isRegionCloseMarker()
public static org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.RegionEventDescriptor getRegionEventDescriptor(Cell cell) throws IOException
cell, IFF the cell is a RegionEventDescriptor type WALEdit.IOExceptionpublic static WALEdit createCompaction(RegionInfo hri, org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.CompactionDescriptor c)
c serialized as its valuepublic static byte[] getRowForRegion(RegionInfo hri)
public static org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.CompactionDescriptor getCompaction(Cell kv) throws IOException
kv - the key valueIOExceptionpublic static boolean isCompactionMarker(Cell cell)
WALProtos.CompactionDescriptorgetCompaction(Cell)public static WALEdit createBulkLoadEvent(RegionInfo hri, org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.BulkLoadDescriptor bulkLoadDescriptor)
hri - The RegionInfo for the region in which we are bulk loadingbulkLoadDescriptor - The descriptor for the Bulk Loaderpublic static org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.BulkLoadDescriptor getBulkLoadDescriptor(Cell cell) throws IOException
cell - the key valueIOExceptionpublic void add(Map<byte[],List<Cell>> familyMap)
familyMap - map of family->editsCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.