@InterfaceAudience.LimitedPrivate(value={"Replication","Coprocesssor"})
public class WALEdit
extends Object
implements org.apache.hadoop.hbase.io.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.
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.
| Modifier and Type | Field and Description |
|---|---|
static byte[] |
BULK_LOAD |
static byte[] |
COMPACTION |
static byte[] |
FLUSH |
static byte[] |
METAFAMILY |
static byte[] |
METAROW |
static byte[] |
REGION_EVENT |
| Constructor and Description |
|---|
WALEdit() |
WALEdit(boolean isReplay)
Deprecated.
Since 2.0.1. Use
WALEdit(int, boolean) instead. |
WALEdit(int cellCount)
Deprecated.
Since 2.0.1. Use
WALEdit(int, boolean) instead. |
WALEdit(int cellCount,
boolean isReplay) |
| Modifier and Type | Method and Description |
|---|---|
WALEdit |
add(org.apache.hadoop.hbase.Cell cell) |
WALEdit |
add(org.apache.hadoop.hbase.Cell cell,
byte[] family) |
void |
add(Map<byte[],List<org.apache.hadoop.hbase.Cell>> familyMap)
Append the given map of family->edits to a WALEdit data structure.
|
static WALEdit |
createBulkLoadEvent(org.apache.hadoop.hbase.client.RegionInfo hri,
org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.BulkLoadDescriptor bulkLoadDescriptor)
Create a bulk loader WALEdit
|
static WALEdit |
createCompaction(org.apache.hadoop.hbase.client.RegionInfo hri,
org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.CompactionDescriptor c)
Create a compaction WALEdit
|
static WALEdit |
createFlushWALEdit(org.apache.hadoop.hbase.client.RegionInfo hri,
org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.FlushDescriptor f) |
static WALEdit |
createRegionEventWALEdit(org.apache.hadoop.hbase.client.RegionInfo hri,
org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.RegionEventDescriptor regionEventDesc) |
long |
estimatedSerializedSizeOf() |
static org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.BulkLoadDescriptor |
getBulkLoadDescriptor(org.apache.hadoop.hbase.Cell cell)
Deserialized and returns a BulkLoadDescriptor from the passed in Cell
|
ArrayList<org.apache.hadoop.hbase.Cell> |
getCells() |
static org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.CompactionDescriptor |
getCompaction(org.apache.hadoop.hbase.Cell kv)
Deserialized and returns a CompactionDescriptor is the KeyValue contains one.
|
Set<byte[]> |
getFamilies()
For use by FSWALEntry ONLY.
|
static org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.FlushDescriptor |
getFlushDescriptor(org.apache.hadoop.hbase.Cell cell) |
static org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.RegionEventDescriptor |
getRegionEventDescriptor(org.apache.hadoop.hbase.Cell cell) |
static byte[] |
getRowForRegion(org.apache.hadoop.hbase.client.RegionInfo hri) |
long |
heapSize() |
static boolean |
isCompactionMarker(org.apache.hadoop.hbase.Cell cell)
Returns true if the given cell is a serialized
WALProtos.CompactionDescriptor |
boolean |
isEmpty() |
boolean |
isMetaEdit() |
static boolean |
isMetaEditFamily(byte[] f) |
static boolean |
isMetaEditFamily(org.apache.hadoop.hbase.Cell cell) |
boolean |
isReplay() |
int |
readFromCells(org.apache.hadoop.hbase.codec.Codec.Decoder cellDecoder,
int expectedCount)
Reads WALEdit from cells.
|
void |
setCells(ArrayList<org.apache.hadoop.hbase.Cell> cells)
This is not thread safe.
|
int |
size() |
String |
toString() |
public static final byte[] METAFAMILY
public static final byte[] METAROW
public static final byte[] COMPACTION
public static final byte[] FLUSH
public static final byte[] REGION_EVENT
public static final byte[] BULK_LOAD
public WALEdit()
@Deprecated public WALEdit(boolean isReplay)
WALEdit(int, boolean) instead.@Deprecated public WALEdit(int cellCount)
WALEdit(int, boolean) instead.public WALEdit(int cellCount,
boolean isReplay)
cellCount - Pass so can pre-size the WALEdit. Optimization.public Set<byte[]> getFamilies()
getCells(); may be null.public static boolean isMetaEditFamily(byte[] f)
f is METAFAMILYpublic static boolean isMetaEditFamily(org.apache.hadoop.hbase.Cell cell)
public boolean isMetaEdit()
public boolean isReplay()
@InterfaceAudience.Private public WALEdit add(org.apache.hadoop.hbase.Cell cell, byte[] family)
@InterfaceAudience.Private public WALEdit add(org.apache.hadoop.hbase.Cell cell)
public boolean isEmpty()
public int size()
public ArrayList<org.apache.hadoop.hbase.Cell> getCells()
@InterfaceAudience.Private public void setCells(ArrayList<org.apache.hadoop.hbase.Cell> cells)
cells - the list of cells that this WALEdit now contains.public int readFromCells(org.apache.hadoop.hbase.codec.Codec.Decoder cellDecoder,
int expectedCount)
throws IOException
cellDecoder - Cell decoder.expectedCount - Expected cell count.IOExceptionpublic long heapSize()
heapSize in interface org.apache.hadoop.hbase.io.HeapSizepublic long estimatedSerializedSizeOf()
public static WALEdit createFlushWALEdit(org.apache.hadoop.hbase.client.RegionInfo hri, org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.FlushDescriptor f)
public static org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.FlushDescriptor getFlushDescriptor(org.apache.hadoop.hbase.Cell cell)
throws IOException
IOExceptionpublic static WALEdit createRegionEventWALEdit(org.apache.hadoop.hbase.client.RegionInfo hri, org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.RegionEventDescriptor regionEventDesc)
public static org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.RegionEventDescriptor getRegionEventDescriptor(org.apache.hadoop.hbase.Cell cell)
throws IOException
IOExceptionpublic static WALEdit createCompaction(org.apache.hadoop.hbase.client.RegionInfo hri, org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.CompactionDescriptor c)
c - c serialized as its valuepublic static byte[] getRowForRegion(org.apache.hadoop.hbase.client.RegionInfo hri)
public static org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.CompactionDescriptor getCompaction(org.apache.hadoop.hbase.Cell kv)
throws IOException
kv - the key valueIOExceptionpublic static boolean isCompactionMarker(org.apache.hadoop.hbase.Cell cell)
WALProtos.CompactionDescriptorgetCompaction(Cell)public static WALEdit createBulkLoadEvent(org.apache.hadoop.hbase.client.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(org.apache.hadoop.hbase.Cell cell)
throws IOException
cell - the key valueIOExceptionpublic void add(Map<byte[],List<org.apache.hadoop.hbase.Cell>> familyMap)
familyMap - map of family->editsCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.