Package org.apache.hadoop.hbase.client
Class MutableRegionInfo
java.lang.Object
org.apache.hadoop.hbase.client.MutableRegionInfo
- All Implemented Interfaces:
Comparable<RegionInfo>
,RegionInfo
An implementation of RegionInfo that adds mutable methods so can build a RegionInfo instance.
Package private. Use
RegionInfoBuilder
creating instances of RegionInfo
s.-
Field Summary
Modifier and TypeFieldDescriptionprivate final String
private final byte[]
private final byte[]
private final int
private static final org.slf4j.Logger
private static final int
private boolean
The new format for a region name contains its encodedName at the end.private final long
private final byte[]
private final int
private boolean
private final byte[]
private final TableName
Fields inherited from interface org.apache.hadoop.hbase.client.RegionInfo
COMPARATOR, DEFAULT_REPLICA_ID, ENC_SEPARATOR, INVALID_REGION_NAME_FORMAT_MESSAGE, MD5_HEX_LENGTH, REPLICA_ID_DELIMITER, REPLICA_ID_FORMAT
-
Constructor Summary
ConstructorDescriptionMutableRegionInfo
(long regionId, TableName tableName, int replicaId) Package private constructor used constructing MutableRegionInfo for the first meta regionsMutableRegionInfo
(TableName tableName, byte[] startKey, byte[] endKey, boolean split, long regionId, int replicaId, boolean offLine) -
Method Summary
Modifier and TypeMethodDescriptionprivate static byte[]
checkEndKey
(byte[] endKey) private static int
checkReplicaId
(int regionId) private static byte[]
checkStartKey
(byte[] startKey) private static TableName
checkTableName
(TableName tableName) 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.boolean
private static int
generateHashCode
(TableName tableName, byte[] startKey, byte[] endKey, long regionId, int replicaId, boolean offLine, byte[] regionName) Returns the encoded region namebyte[]
Returns the encoded region name as an array of bytes.byte[]
Returns the endKeylong
Returns the regionIdbyte[]
Returns the regionName as an array of bytes.Returns Region name as a String for use in logging, etc.int
Returns the region replica idReturns Return a short, printable name for this region (usually encoded name) for us logging.byte[]
Returns the startKeygetTable()
Get current table name of the regionint
hashCode()
boolean
Returns true if this region is a meta regionboolean
Deprecated.since 3.0.0 and will be removed in 4.0.0boolean
isSplit()
Returns True if has been split and has daughters.boolean
Deprecated.since 3.0.0 and will be removed in 4.0.0, UseisSplit()
instead.setOffline
(boolean offLine) The parent of a region split is offline while split daughters hold references to the parent.setSplit
(boolean split) Change the split status flag.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.hadoop.hbase.client.RegionInfo
compareTo, isAdjacent, isDegenerate, isFirst, isLast, isNext, isOverlap
-
Field Details
-
LOG
-
MAX_REPLICA_ID
- See Also:
-
offLine
The new format for a region name contains its encodedName at the end. The encoded name also serves as the directory name for the region in the filesystem. New region name format: <tablename>,,<startkey>,<regionIdTimestamp>.<encodedName>. where, <encodedName> is a hex version of the MD5 hash of <tablename>,<startkey>,<regionIdTimestamp> The old region name format: <tablename>,<startkey>,<regionIdTimestamp> For region names in the old format, the encoded name is a 32-bit JenkinsHash integer value (in its decimal notation, string form).**NOTE** The first hbase:meta region, and regions created by an older version of HBase (0.20 or prior) will continue to use the old region name format.
-
split
-
regionId
-
replicaId
-
regionName
-
startKey
-
endKey
-
hashCode
-
encodedName
-
encodedNameAsBytes
-
tableName
-
-
Constructor Details
-
MutableRegionInfo
MutableRegionInfo(long regionId, TableName tableName, int replicaId) Package private constructor used constructing MutableRegionInfo for the first meta regions -
MutableRegionInfo
MutableRegionInfo(TableName tableName, byte[] startKey, byte[] endKey, boolean split, long regionId, int replicaId, boolean offLine)
-
-
Method Details
-
generateHashCode
private static int generateHashCode(TableName tableName, byte[] startKey, byte[] endKey, long regionId, int replicaId, boolean offLine, byte[] regionName) -
checkStartKey
-
checkEndKey
-
checkTableName
-
checkReplicaId
-
getShortNameToLog
Returns Return a short, printable name for this region (usually encoded name) for us logging.- Specified by:
getShortNameToLog
in interfaceRegionInfo
-
getRegionId
Returns the regionId- Specified by:
getRegionId
in interfaceRegionInfo
-
getRegionName
Description copied from interface:RegionInfo
Returns the regionName as an array of bytes.- Specified by:
getRegionName
in interfaceRegionInfo
- Returns:
- the regionName as an array of bytes.
- See Also:
-
getRegionNameAsString
Returns Region name as a String for use in logging, etc.- Specified by:
getRegionNameAsString
in interfaceRegionInfo
-
getEncodedName
Returns the encoded region name- Specified by:
getEncodedName
in interfaceRegionInfo
-
getEncodedNameAsBytes
Description copied from interface:RegionInfo
Returns the encoded region name as an array of bytes.- Specified by:
getEncodedNameAsBytes
in interfaceRegionInfo
-
getStartKey
Returns the startKey- Specified by:
getStartKey
in interfaceRegionInfo
-
getEndKey
Returns the endKey- Specified by:
getEndKey
in interfaceRegionInfo
-
getTable
Get current table name of the region- Specified by:
getTable
in interfaceRegionInfo
-
containsRange
Returns true if the given inclusive range of rows is fully contained by this region. For example, if the region is foo,a,g and this is passed ["b","c"] or ["a","c"] it will return true, but if this is passed ["b","z"] it will return false.- Specified by:
containsRange
in interfaceRegionInfo
- Throws:
IllegalArgumentException
- if the range passed is invalid (ie. end < start)
-
containsRow
Return true if the given row falls in this region.- Specified by:
containsRow
in interfaceRegionInfo
-
isMetaRegion
Returns true if this region is a meta region- Specified by:
isMetaRegion
in interfaceRegionInfo
-
isSplit
Returns True if has been split and has daughters.- Specified by:
isSplit
in interfaceRegionInfo
-
setSplit
Change the split status flag.- Parameters:
split
- set split status
-
isOffline
Deprecated.since 3.0.0 and will be removed in 4.0.0Description copied from interface:RegionInfo
Returns True if this region is offline.- Specified by:
isOffline
in interfaceRegionInfo
- Returns:
- True if this region is offline.
- See Also:
-
setOffline
The parent of a region split is offline while split daughters hold references to the parent. Offlined regions are closed.- Parameters:
offLine
- Set online/offline status.
-
isSplitParent
Deprecated.since 3.0.0 and will be removed in 4.0.0, UseisSplit()
instead.Description copied from interface:RegionInfo
Returns True if this is a split parent region.- Specified by:
isSplitParent
in interfaceRegionInfo
- Returns:
- True if this is a split parent region.
- See Also:
-
getReplicaId
Returns the region replica id- Specified by:
getReplicaId
in interfaceRegionInfo
- Returns:
- returns region replica id
-
toString
-
equals
-
hashCode
-