@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 |
private ArrayList<Cell> |
cells |
static byte[] |
COMPACTION |
private Set<byte[]> |
families
All the Cell families in
cells . |
static byte[] |
FLUSH |
private static org.slf4j.Logger |
LOG |
static byte[] |
METAFAMILY |
static byte[] |
METAROW |
static byte[] |
REGION_EVENT |
private boolean |
replay |
Constructor and Description |
---|
WALEdit() |
WALEdit(boolean isReplay)
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) |
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.
|
private WALEdit |
addCell(Cell cell) |
private void |
addFamily(byte[] family) |
static WALEdit |
createBulkLoadEvent(RegionInfo hri,
org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.BulkLoadDescriptor bulkLoadDescriptor)
Create a bulk loader WALEdit
|
static WALEdit |
createCompaction(RegionInfo hri,
org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.CompactionDescriptor c)
Create a compaction WALEdit
|
static WALEdit |
createFlushWALEdit(RegionInfo hri,
org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.FlushDescriptor f) |
static WALEdit |
createRegionEventWALEdit(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(Cell cell)
Deserialized and returns a BulkLoadDescriptor from the passed in Cell
|
ArrayList<Cell> |
getCells() |
static org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.CompactionDescriptor |
getCompaction(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(Cell cell) |
private Set<byte[]> |
getOrCreateFamilies() |
static org.apache.hadoop.hbase.shaded.protobuf.generated.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() |
private static final org.slf4j.Logger LOG
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
private final boolean replay
public WALEdit()
@Deprecated public WALEdit(boolean isReplay)
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.private Set<byte[]> getOrCreateFamilies()
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, 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
IOException
public static WALEdit createRegionEventWALEdit(RegionInfo hri, org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.RegionEventDescriptor regionEventDesc)
public static org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.RegionEventDescriptor getRegionEventDescriptor(Cell cell) throws IOException
IOException
public static WALEdit createCompaction(RegionInfo hri, org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.CompactionDescriptor c)
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 valueIOException
public static boolean isCompactionMarker(Cell cell)
WALProtos.CompactionDescriptor
getCompaction(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 valueIOException
public void add(Map<byte[],List<Cell>> familyMap)
familyMap
- map of family->editsprivate void addFamily(byte[] family)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.