@InterfaceAudience.Public @InterfaceStability.Evolving public class HRegionInfo extends Object implements Comparable<HRegionInfo>
Modifier and Type | Field and Description |
---|---|
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 |
VERSION
Deprecated.
|
Constructor and Description |
---|
HRegionInfo()
Deprecated.
Used by Writables and Writables are going away.
|
HRegionInfo(HRegionInfo other)
Costruct a copy of another HRegionInfo
|
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
|
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(HBaseProtos.RegionInfo proto)
Convert a RegionInfo to a HRegionInfo
|
static 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,
long regionid,
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) |
KeyValue.KVComparator |
getComparator() |
static PairOfSameType<HRegionInfo> |
getDaughterRegions(Result data)
Returns the daughter regions by reading the corresponding columns of the catalog table
Result.
|
String |
getEncodedName() |
byte[] |
getEncodedNameAsBytes() |
byte[] |
getEndKey() |
static HRegionInfo |
getHRegionInfo(Result data)
Returns HRegionInfo object from the column
HConstants.CATALOG_FAMILY:HConstants.REGIONINFO_QUALIFIER of the catalog
table Result.
|
static HRegionInfo |
getHRegionInfo(Result r,
byte[] qualifier)
Returns the HRegionInfo object from the column
HConstants.CATALOG_FAMILY and
qualifier of the catalog table result. |
static Pair<HRegionInfo,ServerName> |
getHRegionInfoAndServerName(Result r)
Extract a HRegionInfo and ServerName from catalog table
Result . |
static PairOfSameType<HRegionInfo> |
getMergeRegions(Result data)
Returns the merge regions by reading the corresponding columns of the catalog table
Result.
|
long |
getRegionId() |
byte[] |
getRegionName() |
String |
getRegionNameAsString() |
static long |
getSeqNumDuringOpen(Result r)
The latest seqnum that the server writing to meta observed when opening the region.
|
static ServerName |
getServerName(Result r)
Returns a
ServerName from catalog table Result . |
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.
Since 0.96.0; use #getTable()
|
static byte[] |
getTableName(byte[] regionName)
Deprecated.
Since 0.96.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() |
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 NO_HASH
public static final HRegionInfo FIRST_META_REGIONINFO
@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(HRegionInfo other)
other
- 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, 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?).@Deprecated public static byte[] getTableName(byte[] regionName)
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 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 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 KeyValue.KVComparator getComparator()
KeyValue
s.public static HBaseProtos.RegionInfo convert(HRegionInfo info)
info
- the HRegionInfo to convertpublic static HRegionInfo convert(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 DeserializationException
bytes
- A pb RegionInfo serialized with a pb magic prefix.HRegionInfo
DeserializationException
toByteArray()
public static HRegionInfo parseFrom(byte[] bytes, int offset, int len) throws 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
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 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
public static HRegionInfo getHRegionInfo(Result data)
data
- a Result object from the catalog table scanpublic static PairOfSameType<HRegionInfo> getDaughterRegions(Result data) throws IOException
data
- a Result object from the catalog table scanIOException
public static PairOfSameType<HRegionInfo> getMergeRegions(Result data) throws IOException
data
- a Result object from the catalog table scanIOException
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
.public static ServerName getServerName(Result r)
ServerName
from catalog table Result
.r
- Result to pull frompublic 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 © 2015 The Apache Software Foundation. All Rights Reserved.