@InterfaceAudience.Private public class CatalogFamilyFormat extends Object
For each table range ('Region'), there is a single row, formatted as: <tableName>,<startKey>,<regionId>,<encodedRegionName>. This row is the serialized regionName of the default region replica. Columns are: info:regioninfo => contains serialized HRI for the default region replica info:server => contains hostname:port (in string form) for the server hosting the default regionInfo replica info:server_<replicaId> => contains hostname:port (in string form) for the server hosting the regionInfo replica with replicaId info:serverstartcode => contains server start code (in binary long form) for the server hosting the default regionInfo replica info:serverstartcode_<replicaId> => contains server start code (in binary long form) for the server hosting the regionInfo replica with replicaId info:seqnumDuringOpen => contains seqNum (in binary long form) for the region at the time the server opened the region with default replicaId info:seqnumDuringOpen_<replicaId> => contains seqNum (in binary long form) for the region at the time the server opened the region with replicaId info:splitA => contains a serialized HRI for the first daughter region if the region is split info:splitB => contains a serialized HRI for the second daughter region if the region is split info:merge* => contains a serialized HRI for a merge parent region. There will be two or more of these columns in a row. A row that has these columns is undergoing a merge and is the result of the merge. Columns listed in marge* columns are the parents of this merged region. Example columns: info:merge0001, info:merge0002. You make also see 'mergeA', and 'mergeB'. This is old form replaced by the new format that allows for more than two parents to be merged at a time.
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
(package private) static char |
META_REPLICA_ID_DELIMITER
The delimiter for meta columns for replicaIds > 0
|
private static Pattern |
SERVER_COLUMN_PATTERN
A regex for parsing server columns from meta.
|
Constructor and Description |
---|
CatalogFamilyFormat() |
Modifier and Type | Method and Description |
---|---|
static List<RegionInfo> |
getMergeRegions(Cell[] cells)
Returns Deserialized regioninfo values taken from column values that match the regex
'info:merge.*' in array of
cells . |
static Map<String,RegionInfo> |
getMergeRegionsWithName(Cell[] cells)
Returns Deserialized values of <qualifier,regioninfo> pairs taken from column values that
match the regex 'info:merge.*' in array of
cells . |
static byte[] |
getMetaKeyForRegion(RegionInfo regionInfo)
Returns the row key to use for this regionInfo
|
static RegionInfo |
getRegionInfo(Result data)
Returns RegionInfo object from the column
HConstants.CATALOG_FAMILY:HConstants.REGIONINFO_QUALIFIER of the catalog table Result.
|
static RegionInfo |
getRegionInfo(Result r,
byte[] qualifier)
Returns the RegionInfo object from the column
HConstants.CATALOG_FAMILY and
qualifier of the catalog table result. |
static HRegionLocation |
getRegionLocation(Result r,
RegionInfo regionInfo,
int replicaId)
Returns the HRegionLocation parsed from the given meta row Result for the given regionInfo and
replicaId.
|
static RegionLocations |
getRegionLocations(Result r)
Returns an HRegionLocationList extracted from the result.
|
static byte[] |
getRegionStateColumn(int replicaId)
Returns the column qualifier for serialized region state
|
static byte[] |
getSeqNumColumn(int replicaId)
Returns the column qualifier for seqNum column for replicaId
|
private static long |
getSeqNumDuringOpen(Result r,
int replicaId)
The latest seqnum that the server writing to meta observed when opening the region.
|
static byte[] |
getServerColumn(int replicaId)
Returns the column qualifier for server column for replicaId
|
static ServerName |
getServerName(Result r,
int replicaId)
Returns a
ServerName from catalog table Result . |
static byte[] |
getServerNameColumn(int replicaId)
Returns the column qualifier for serialized region state
|
static byte[] |
getStartCodeColumn(int replicaId)
Returns the column qualifier for server start code column for replicaId
|
static TableState |
getTableState(Result r)
Decode table state from META Result.
|
static boolean |
hasMergeRegions(Cell[] cells)
Returns True if any merge regions present in
cells ; i.e. |
static boolean |
isMergeQualifierPrefix(Cell cell)
Returns True if the column in
cell matches the regex 'info:merge.*'. |
static RegionInfo |
parseRegionInfoFromRegionName(byte[] regionName)
Returns an HRI parsed from this regionName.
|
(package private) static int |
parseReplicaIdFromServerColumn(byte[] serverColumn)
Parses the replicaId from the server column qualifier.
|
private static final org.slf4j.Logger LOG
private static final Pattern SERVER_COLUMN_PATTERN
static final char META_REPLICA_ID_DELIMITER
public CatalogFamilyFormat()
public static RegionInfo parseRegionInfoFromRegionName(byte[] regionName) throws IOException
RegionInfo
or RegionInfoBuilder
.IOException
@Nullable public static RegionInfo getRegionInfo(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 qualifierpublic static RegionInfo getRegionInfo(Result data)
data
- a Result object from the catalog table scanpublic static HRegionLocation getRegionLocation(Result r, RegionInfo regionInfo, int replicaId)
r
- the meta row resultregionInfo
- RegionInfo for default replicareplicaId
- the replicaId for the HRegionLocation@Nullable public static RegionLocations getRegionLocations(Result r)
@Nullable public static ServerName getServerName(Result r, int replicaId)
ServerName
from catalog table Result
.r
- Result to pull frompublic static byte[] getServerColumn(int replicaId)
replicaId
- the replicaId of the regionpublic static byte[] getStartCodeColumn(int replicaId)
replicaId
- the replicaId of the regionprivate static long getSeqNumDuringOpen(Result r, int replicaId)
getServerName
was written.r
- Result to pull the seqNum frompublic static byte[] getSeqNumColumn(int replicaId)
replicaId
- the replicaId of the regionstatic int parseReplicaIdFromServerColumn(byte[] serverColumn)
serverColumn
- the column qualifierpublic static byte[] getMetaKeyForRegion(RegionInfo regionInfo)
public static byte[] getRegionStateColumn(int replicaId)
replicaId
- the replicaId of the regionpublic static byte[] getServerNameColumn(int replicaId)
replicaId
- the replicaId of the region@Nullable public static TableState getTableState(Result r) throws IOException
IOException
@Nullable public static Map<String,RegionInfo> getMergeRegionsWithName(Cell[] cells)
cells
.@Nullable public static List<RegionInfo> getMergeRegions(Cell[] cells)
cells
.public static boolean hasMergeRegions(Cell[] cells)
cells
; i.e. the column in
cell
matches the regex 'info:merge.*'.public static boolean isMergeQualifierPrefix(Cell cell)
cell
matches the regex 'info:merge.*'.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.