@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.
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(Cell cell) |
WALEdit |
add(Cell cell,
byte[] family) |
void |
add(Map<byte[],List<Cell>> familyMap)
Append the given map of family->edits to a WALEdit data structure.
|
static WALEdit |
createBulkLoadEvent(RegionInfo hri,
WALProtos.BulkLoadDescriptor bulkLoadDescriptor)
Create a bulk loader WALEdit
|
static WALEdit |
createCompaction(RegionInfo hri,
WALProtos.CompactionDescriptor c)
Create a compaction WALEdit
|
static WALEdit |
createFlushWALEdit(RegionInfo hri,
WALProtos.FlushDescriptor f) |
static WALEdit |
createRegionEventWALEdit(RegionInfo hri,
WALProtos.RegionEventDescriptor regionEventDesc) |
long |
estimatedSerializedSizeOf() |
static WALProtos.BulkLoadDescriptor |
getBulkLoadDescriptor(Cell cell)
Deserialized and returns a BulkLoadDescriptor from the passed in Cell
|
ArrayList<Cell> |
getCells() |
static WALProtos.CompactionDescriptor |
getCompaction(Cell kv)
Deserialized and returns a CompactionDescriptor is the KeyValue contains one.
|
Set<byte[]> |
getFamilies()
For use by FSWALEntry ONLY.
|
static WALProtos.FlushDescriptor |
getFlushDescriptor(Cell cell) |
static WALProtos.RegionEventDescriptor |
getRegionEventDescriptor(Cell cell) |
static byte[] |
getRowForRegion(RegionInfo hri) |
long |
heapSize() |
static boolean |
isCompactionMarker(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(Cell cell) |
boolean |
isReplay() |
int |
readFromCells(Codec.Decoder cellDecoder,
int expectedCount)
Reads WALEdit from cells.
|
void |
setCells(ArrayList<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 METAFAMILY
public static boolean isMetaEditFamily(Cell cell)
public boolean isMetaEdit()
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.IOException
public long heapSize()
public long estimatedSerializedSizeOf()
public static WALEdit createFlushWALEdit(RegionInfo hri, WALProtos.FlushDescriptor f)
public static WALProtos.FlushDescriptor getFlushDescriptor(Cell cell) throws IOException
IOException
public static WALEdit createRegionEventWALEdit(RegionInfo hri, WALProtos.RegionEventDescriptor regionEventDesc)
public static WALProtos.RegionEventDescriptor getRegionEventDescriptor(Cell cell) throws IOException
IOException
public static WALEdit createCompaction(RegionInfo hri, WALProtos.CompactionDescriptor c)
c
- c
serialized as its valuepublic static byte[] getRowForRegion(RegionInfo hri)
public static WALProtos.CompactionDescriptor getCompaction(Cell kv) throws IOException
kv
- the key valueIOException
public static boolean isCompactionMarker(Cell cell)
WALProtos.CompactionDescriptor
getCompaction(Cell)
public static WALEdit createBulkLoadEvent(RegionInfo hri, WALProtos.BulkLoadDescriptor bulkLoadDescriptor)
hri
- The RegionInfo for the region in which we are bulk loadingbulkLoadDescriptor
- The descriptor for the Bulk Loaderpublic static WALProtos.BulkLoadDescriptor getBulkLoadDescriptor(Cell cell) throws IOException
cell
- the key valueIOException
public void add(Map<byte[],List<Cell>> familyMap)
familyMap
- map of family->editsCopyright © 2007–2019 Cloudera. All rights reserved.