@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 int |
MD5_HEX_LENGTH |
static String |
NO_HASH |
static byte |
REPLICA_ID_DELIMITER |
static String |
REPLICA_ID_FORMAT |
static byte |
VERSION
Deprecated.
|
Constructor and Description |
---|
HRegionInfo()
Deprecated.
As of release 0.96
(HBASE-5453).
This will be removed in HBase 2.0.0.
Used by Writables and Writables are going away.
|
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() |
static PairOfSameType<HRegionInfo> |
getDaughterRegions(Result data)
Deprecated.
use MetaTableAccessor methods for interacting with meta layouts
|
String |
getEncodedName() |
byte[] |
getEncodedNameAsBytes() |
byte[] |
getEndKey() |
static HRegionInfo |
getHRegionInfo(Result data)
Deprecated.
use MetaTableAccessor methods for interacting with meta layouts
|
static HRegionInfo |
getHRegionInfo(Result r,
byte[] qualifier)
Deprecated.
use MetaTableAccessor methods for interacting with meta layouts
|
static Pair<HRegionInfo,ServerName> |
getHRegionInfoAndServerName(Result r)
Deprecated.
use MetaTableAccessor methods for interacting with meta layouts
|
static PairOfSameType<HRegionInfo> |
getMergeRegions(Result data)
Deprecated.
use MetaTableAccessor methods for interacting with meta layouts
|
long |
getRegionId() |
byte[] |
getRegionName() |
String |
getRegionNameAsString() |
int |
getReplicaId()
Returns the region replica id
|
static long |
getSeqNumDuringOpen(Result r)
Deprecated.
use MetaTableAccessor methods for interacting with meta layouts
|
static ServerName |
getServerName(Result r)
Deprecated.
use MetaTableAccessor methods for interacting with meta layouts
|
String |
getShortNameToLog() |
byte[] |
getStartKey() |
static byte[] |
getStartKey(byte[] regionName)
Gets the start key from the specified region name.
|
TableName |
getTable()
Get current table name of the region
|
static TableName |
getTable(byte[] regionName)
Gets the table name from the specified region name.
|
byte[] |
getTableName()
Deprecated.
As of release 0.96
(HBASE-9508).
This will be removed in HBase 2.0.0. Use
getTable() . |
static byte[] |
getTableName(byte[] regionName)
Deprecated.
As of release 0.96
(HBASE-9508).
This will be removed in HBase 2.0.0. Use
getTable(byte[]) . |
byte |
getVersion()
Deprecated.
HRI is no longer a VersionedWritable
|
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 |
readFields(DataInput in)
Deprecated.
Use protobuf deserialization instead.
|
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() |
void |
write(DataOutput out)
Deprecated.
Use protobuf serialization instead. See
toByteArray() and
toDelimitedByteArray() |
@Deprecated public static final byte VERSION
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 String NO_HASH
public static final HRegionInfo FIRST_META_REGIONINFO
public HRegionInfo(long regionId, TableName tableName, int replicaId)
@Deprecated public HRegionInfo()
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 format@Deprecated public static byte[] getTableName(byte[] regionName)
getTable(byte[])
.regionName
- public static TableName getTable(byte[] regionName)
getTableName(byte[])
only returns a TableName
rather than a byte array.regionName
- getTableName(byte[])
public 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()
@Deprecated public byte[] getTableName()
public TableName getTable()
getTableName()
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()
@Deprecated public byte getVersion()
@Deprecated public void write(DataOutput out) throws IOException
IOException
@Deprecated public void readFields(DataInput in) throws IOException
IOException
parseFrom(byte[])
public int compareTo(HRegionInfo o)
compareTo
in interface Comparable<HRegionInfo>
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()
@Deprecated public static Pair<HRegionInfo,ServerName> getHRegionInfoAndServerName(Result r)
Result
.r
- Result to pull fromHRegionInfo
and the ServerName
(or null for server address if no address set in hbase:meta).IOException
@Deprecated public static HRegionInfo getHRegionInfo(Result data)
data
- a Result object from the catalog table scan@Deprecated public static PairOfSameType<HRegionInfo> getDaughterRegions(Result data) throws IOException
data
- a Result object from the catalog table scanIOException
@Deprecated public static PairOfSameType<HRegionInfo> getMergeRegions(Result data) throws IOException
data
- a Result object from the catalog table scanIOException
@Deprecated public static HRegionInfo getHRegionInfo(Result r, byte[] qualifier)
HConstants.CATALOG_FAMILY
and
qualifier
of the catalog table result.r
- a Result object from the catalog table scanqualifier
- Column family qualifier -- either
HConstants.SPLITA_QUALIFIER
, HConstants.SPLITB_QUALIFIER
or
HConstants.REGIONINFO_QUALIFIER
.@Deprecated public static ServerName getServerName(Result r)
@Deprecated public static long getSeqNumDuringOpen(Result r)
getServerName(Result)
was written.r
- Result to pull the seqNum frompublic 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–2016 The Apache Software Foundation. All rights reserved.