@InterfaceAudience.Public @InterfaceStability.Evolving public class HRegionInfo extends Object implements Comparable<HRegionInfo>
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_REPLICA_ID |
static String |
ENCODED_REGION_NAME_REGEX
A non-capture group so that this can be embedded.
|
static HRegionInfo |
FIRST_META_REGIONINFO
HRegionInfo for first meta region
|
static byte[] |
HIDDEN_END_KEY |
static byte[] |
HIDDEN_START_KEY |
static int |
MD5_HEX_LENGTH |
static String |
NO_HASH |
static byte |
REPLICA_ID_DELIMITER |
static String |
REPLICA_ID_FORMAT |
Constructor and Description |
---|
HRegionInfo(HRegionInfo other)
Costruct a copy of another HRegionInfo
|
HRegionInfo(HRegionInfo other,
int replicaId) |
HRegionInfo(long regionId,
TableName tableName,
int replicaId) |
HRegionInfo(TableName tableName) |
HRegionInfo(TableName tableName,
byte[] startKey,
byte[] endKey)
Construct HRegionInfo with explicit parameters
|
HRegionInfo(TableName tableName,
byte[] startKey,
byte[] endKey,
boolean split)
Construct HRegionInfo with explicit parameters
|
HRegionInfo(TableName tableName,
byte[] startKey,
byte[] endKey,
boolean split,
long regionid)
Construct HRegionInfo with explicit parameters
|
HRegionInfo(TableName tableName,
byte[] startKey,
byte[] endKey,
boolean split,
long regionid,
int replicaId)
Construct HRegionInfo with explicit parameters
|
Modifier and Type | Method and Description |
---|---|
static boolean |
areAdjacent(HRegionInfo regionA,
HRegionInfo regionB)
Check whether two regions are adjacent
|
int |
compareTo(HRegionInfo o) |
boolean |
containsRange(byte[] rangeStartKey,
byte[] rangeEndKey)
Returns true if the given inclusive range of rows is fully contained
by this region.
|
boolean |
containsRow(byte[] row)
Return true if the given row falls in this region.
|
static HRegionInfo |
convert(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionInfo proto)
Convert a RegionInfo to a HRegionInfo
|
static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionInfo |
convert(HRegionInfo info)
Convert a HRegionInfo to a RegionInfo
|
static byte[] |
createRegionName(TableName tableName,
byte[] startKey,
byte[] id,
boolean newFormat)
Make a region name of passed parameters.
|
static byte[] |
createRegionName(TableName tableName,
byte[] startKey,
byte[] id,
int replicaId,
boolean newFormat)
Make a region name of passed parameters.
|
static byte[] |
createRegionName(TableName tableName,
byte[] startKey,
long regionid,
boolean newFormat)
Make a region name of passed parameters.
|
static byte[] |
createRegionName(TableName tableName,
byte[] startKey,
long regionid,
int replicaId,
boolean newFormat)
Make a region name of passed parameters.
|
static byte[] |
createRegionName(TableName tableName,
byte[] startKey,
String id,
boolean newFormat)
Make a region name of passed parameters.
|
static String |
encodeRegionName(byte[] regionName) |
boolean |
equals(Object o) |
org.apache.hadoop.hbase.KeyValue.KVComparator |
getComparator()
Deprecated.
Use Region#getCellComparator(). deprecated for hbase 2.0, remove for hbase 3.0
|
static String |
getDescriptiveNameFromRegionStateForDisplay(org.apache.hadoop.hbase.master.RegionState state,
org.apache.hadoop.conf.Configuration conf)
Get the descriptive name as
RegionState does it but with hidden
startkey optionally |
String |
getEncodedName() |
byte[] |
getEncodedNameAsBytes() |
byte[] |
getEndKey() |
static byte[] |
getEndKeyForDisplay(HRegionInfo hri,
org.apache.hadoop.conf.Configuration conf)
Get the end key for display.
|
long |
getRegionId() |
byte[] |
getRegionName() |
String |
getRegionNameAsString() |
static String |
getRegionNameAsStringForDisplay(HRegionInfo hri,
org.apache.hadoop.conf.Configuration conf)
Get the region name for display.
|
static byte[] |
getRegionNameForDisplay(HRegionInfo hri,
org.apache.hadoop.conf.Configuration conf)
Get the region name for display.
|
int |
getReplicaId()
Returns the region replica id
|
String |
getShortNameToLog() |
byte[] |
getStartKey() |
static byte[] |
getStartKey(byte[] regionName)
Gets the start key from the specified region name.
|
static byte[] |
getStartKeyForDisplay(HRegionInfo hri,
org.apache.hadoop.conf.Configuration conf)
Get the start key for display.
|
TableName |
getTable()
Get current table name of the region
|
static TableName |
getTable(byte[] regionName)
Gets the table name from the specified region name.
|
int |
hashCode() |
boolean |
isMetaRegion() |
boolean |
isMetaTable() |
boolean |
isOffline() |
boolean |
isSplit() |
boolean |
isSplitParent() |
boolean |
isSystemTable() |
static List<HRegionInfo> |
parseDelimitedFrom(byte[] bytes,
int offset,
int length)
Parses all the HRegionInfo instances from the passed in stream until EOF.
|
static HRegionInfo |
parseFrom(byte[] bytes) |
static HRegionInfo |
parseFrom(byte[] bytes,
int offset,
int len) |
static HRegionInfo |
parseFrom(DataInputStream in)
Parses an HRegionInfo instance from the passed in stream.
|
static HRegionInfo |
parseFromOrNull(byte[] bytes) |
static HRegionInfo |
parseFromOrNull(byte[] bytes,
int offset,
int len) |
static byte[][] |
parseRegionName(byte[] regionName)
Separate elements of a regionName.
|
static String |
prettyPrint(String encodedRegionName)
Use logging.
|
void |
setOffline(boolean offLine)
The parent of a region split is offline while split daughters hold
references to the parent.
|
void |
setSplit(boolean split) |
byte[] |
toByteArray() |
byte[] |
toDelimitedByteArray()
Use this instead of
toByteArray() when writing to a stream and you want to use
the pb mergeDelimitedFrom (w/o the delimiter, pb reads to EOF which may not be what you want). |
static byte[] |
toDelimitedByteArray(HRegionInfo... infos)
Serializes given HRegionInfo's as a byte array.
|
String |
toString() |
public static final int MD5_HEX_LENGTH
public static final String ENCODED_REGION_NAME_REGEX
public static final String REPLICA_ID_FORMAT
public static final byte REPLICA_ID_DELIMITER
public static final int DEFAULT_REPLICA_ID
public static final byte[] HIDDEN_END_KEY
public static final byte[] HIDDEN_START_KEY
public static final HRegionInfo FIRST_META_REGIONINFO
public HRegionInfo(long regionId, TableName tableName, int replicaId)
public HRegionInfo(TableName tableName)
public HRegionInfo(TableName tableName, byte[] startKey, byte[] endKey) throws IllegalArgumentException
tableName
- the table namestartKey
- first key in regionendKey
- end of key rangeIllegalArgumentException
public HRegionInfo(TableName tableName, byte[] startKey, byte[] endKey, boolean split) throws IllegalArgumentException
tableName
- the table descriptorstartKey
- first key in regionendKey
- end of key rangesplit
- true if this region has split and we have daughter regions
regions that may or may not hold references to this region.IllegalArgumentException
public HRegionInfo(TableName tableName, byte[] startKey, byte[] endKey, boolean split, long regionid) throws IllegalArgumentException
tableName
- the table descriptorstartKey
- first key in regionendKey
- end of key rangesplit
- true if this region has split and we have daughter regions
regions that may or may not hold references to this region.regionid
- Region id to use.IllegalArgumentException
public HRegionInfo(TableName tableName, byte[] startKey, byte[] endKey, boolean split, long regionid, int replicaId) throws IllegalArgumentException
tableName
- the table descriptorstartKey
- first key in regionendKey
- end of key rangesplit
- true if this region has split and we have daughter regions
regions that may or may not hold references to this region.regionid
- Region id to use.replicaId
- the replicaId to useIllegalArgumentException
public HRegionInfo(HRegionInfo other)
other
- public HRegionInfo(HRegionInfo other, int replicaId)
public static String encodeRegionName(byte[] regionName)
regionName
- public String getShortNameToLog()
public static String prettyPrint(String encodedRegionName)
encodedRegionName
- The encoded regionname.hbase:meta
if passed 1028785192
else returns
encodedRegionName
public static byte[] createRegionName(TableName tableName, byte[] startKey, long regionid, boolean newFormat)
tableName
- startKey
- Can be nullregionid
- Region id (Usually timestamp from when region was created).newFormat
- should we create the region name in the new format
(such that it contains its encoded name?).public static byte[] createRegionName(TableName tableName, byte[] startKey, String id, boolean newFormat)
tableName
- startKey
- Can be nullid
- Region id (Usually timestamp from when region was created).newFormat
- should we create the region name in the new format
(such that it contains its encoded name?).public static byte[] createRegionName(TableName tableName, byte[] startKey, long regionid, int replicaId, boolean newFormat)
tableName
- startKey
- Can be nullregionid
- Region id (Usually timestamp from when region was created).replicaId
- newFormat
- should we create the region name in the new format
(such that it contains its encoded name?).public static byte[] createRegionName(TableName tableName, byte[] startKey, byte[] id, boolean newFormat)
tableName
- startKey
- Can be nullid
- Region id (Usually timestamp from when region was created).newFormat
- should we create the region name in the new format
(such that it contains its encoded name?).public static byte[] createRegionName(TableName tableName, byte[] startKey, byte[] id, int replicaId, boolean newFormat)
tableName
- startKey
- Can be nullid
- Region id (Usually timestamp from when region was created).replicaId
- newFormat
- should we create the region name in the new formatpublic static TableName getTable(byte[] regionName)
regionName
- to extract the table name frompublic static byte[] getStartKey(byte[] regionName) throws IOException
regionName
- IOException
public static byte[][] parseRegionName(byte[] regionName) throws IOException
regionName
- IOException
public long getRegionId()
public byte[] getRegionName()
getRegionNameAsString()
public String getRegionNameAsString()
public String getEncodedName()
public byte[] getEncodedNameAsBytes()
public byte[] getStartKey()
public byte[] getEndKey()
public boolean containsRange(byte[] rangeStartKey, byte[] rangeEndKey)
IllegalArgumentException
- if the range passed is invalid (ie. end < start)public boolean containsRow(byte[] row)
public boolean isMetaTable()
public boolean isMetaRegion()
public boolean isSystemTable()
public boolean isSplit()
public void setSplit(boolean split)
split
- set split statuspublic boolean isOffline()
public void setOffline(boolean offLine)
offLine
- Set online/offline status.public boolean isSplitParent()
public int getReplicaId()
public String toString()
toString
in class Object
Object.toString()
public boolean equals(Object o)
equals
in class Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public int compareTo(HRegionInfo o)
compareTo
in interface Comparable<HRegionInfo>
@Deprecated public org.apache.hadoop.hbase.KeyValue.KVComparator getComparator()
KeyValue
s.public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionInfo convert(HRegionInfo info)
info
- the HRegionInfo to convertpublic static HRegionInfo convert(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionInfo proto)
proto
- the RegionInfo to convertpublic byte[] toByteArray()
parseFrom(byte[])
public static HRegionInfo parseFromOrNull(byte[] bytes)
HRegionInfo
or null if we failed deserialize or passed bytes nulltoByteArray()
public static HRegionInfo parseFromOrNull(byte[] bytes, int offset, int len)
HRegionInfo
or null
if we failed deserialize or passed bytes nulltoByteArray()
public static HRegionInfo parseFrom(byte[] bytes) throws org.apache.hadoop.hbase.exceptions.DeserializationException
bytes
- A pb RegionInfo serialized with a pb magic prefix.HRegionInfo
org.apache.hadoop.hbase.exceptions.DeserializationException
toByteArray()
public static HRegionInfo parseFrom(byte[] bytes, int offset, int len) throws org.apache.hadoop.hbase.exceptions.DeserializationException
bytes
- A pb RegionInfo serialized with a pb magic prefix.offset
- starting point in the byte arraylen
- length to read on the byte arrayHRegionInfo
org.apache.hadoop.hbase.exceptions.DeserializationException
toByteArray()
public byte[] toDelimitedByteArray() throws IOException
toByteArray()
when writing to a stream and you want to use
the pb mergeDelimitedFrom (w/o the delimiter, pb reads to EOF which may not be what you want).IOException
toByteArray()
public static String getDescriptiveNameFromRegionStateForDisplay(org.apache.hadoop.hbase.master.RegionState state, org.apache.hadoop.conf.Configuration conf)
RegionState
does it but with hidden
startkey optionallystate
- conf
- public static byte[] getEndKeyForDisplay(HRegionInfo hri, org.apache.hadoop.conf.Configuration conf)
hri
- conf
- public static byte[] getStartKeyForDisplay(HRegionInfo hri, org.apache.hadoop.conf.Configuration conf)
hri
- conf
- public static String getRegionNameAsStringForDisplay(HRegionInfo hri, org.apache.hadoop.conf.Configuration conf)
hri
- conf
- public static byte[] getRegionNameForDisplay(HRegionInfo hri, org.apache.hadoop.conf.Configuration conf)
hri
- conf
- public static HRegionInfo parseFrom(DataInputStream in) throws IOException
toDelimitedByteArray()
in
- IOException
public static byte[] toDelimitedByteArray(HRegionInfo... infos) throws IOException
toByteArray()
when
writing to a stream and you want to use the pb mergeDelimitedFrom (w/o the delimiter, pb reads
to EOF which may not be what you want). parseDelimitedFrom(byte[], int, int)
can
be used to read back the instances.infos
- HRegionInfo objects to serializeIOException
toByteArray()
public static List<HRegionInfo> parseDelimitedFrom(byte[] bytes, int offset, int length) throws IOException
toDelimitedByteArray()
bytes
- serialized bytesoffset
- the start offset into the byte[] bufferlength
- how far we should read into the byte[] bufferIOException
public static boolean areAdjacent(HRegionInfo regionA, HRegionInfo regionB)
regionA
- regionB
- Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.