Package org.apache.hadoop.hbase
Class CatalogFamilyFormat
java.lang.Object
org.apache.hadoop.hbase.CatalogFamilyFormat
Helper class for generating/parsing
 "info" family cells in meta table.
 
 The cells in catalog family are:
 
 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.
 - 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Logger(package private) static final charThe delimiter for meta columns for replicaIds > 0private static final PatternA regex for parsing server columns from meta.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic List<RegionInfo>getMergeRegions(Cell[] cells) Returns Deserialized regioninfo values taken from column values that match the regex 'info:merge.*' in array ofcells.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 ofcells.static byte[]getMetaKeyForRegion(RegionInfo regionInfo) Returns the row key to use for this regionInfostatic RegionInfogetRegionInfo(Result data) Returns RegionInfo object from the column HConstants.CATALOG_FAMILY:HConstants.REGIONINFO_QUALIFIER of the catalog table Result.static RegionInfogetRegionInfo(Result r, byte[] qualifier) Returns the RegionInfo object from the columnHConstants.CATALOG_FAMILYandqualifierof the catalog table result.static HRegionLocationgetRegionLocation(Result r, RegionInfo regionInfo, int replicaId) Returns the HRegionLocation parsed from the given meta row Result for the given regionInfo and replicaId.static RegionLocationsReturns an HRegionLocationList extracted from the result.static byte[]getRegionStateColumn(int replicaId) Returns the column qualifier for serialized region statestatic byte[]getSeqNumColumn(int replicaId) Returns the column qualifier for seqNum column for replicaIdprivate static longgetSeqNumDuringOpen(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 replicaIdstatic ServerNamegetServerName(Result r, int replicaId) Returns aServerNamefrom catalog tableResult.static byte[]getServerNameColumn(int replicaId) Returns the column qualifier for serialized region statestatic byte[]getStartCodeColumn(int replicaId) Returns the column qualifier for server start code column for replicaIdstatic TableStateDecode table state from META Result.static booleanhasMergeRegions(Cell[] cells) Returns True if any merge regions present incells; i.e.static booleanisMergeQualifierPrefix(Cell cell) Returns True if the column incellmatches the regex 'info:merge.*'.static RegionInfoparseRegionInfoFromRegionName(byte[] regionName) Returns an HRI parsed from this regionName.(package private) static intparseReplicaIdFromServerColumn(byte[] serverColumn) Parses the replicaId from the server column qualifier.
- 
Field Details- 
LOG
- 
SERVER_COLUMN_PATTERNA regex for parsing server columns from meta. See above javadoc for meta layout
- 
META_REPLICA_ID_DELIMITERThe delimiter for meta columns for replicaIds > 0- See Also:
 
 
- 
- 
Constructor Details- 
CatalogFamilyFormatpublic CatalogFamilyFormat()
 
- 
- 
Method Details- 
parseRegionInfoFromRegionNameReturns an HRI parsed from this regionName. Not all the fields of the HRI is stored in the name, so the returned object should only be used for the fields in the regionName. Since the returned object does not contain all the fields, we do not expose this method in public API, such asRegionInfoorRegionInfoBuilder.- Throws:
- IOException
 
- 
getRegionInfoReturns the RegionInfo object from the columnHConstants.CATALOG_FAMILYandqualifierof the catalog table result.- Parameters:
- r- a Result object from the catalog table scan
- qualifier- Column family qualifier
- Returns:
- An RegionInfo instance or null.
 
- 
getRegionInfoReturns RegionInfo object from the column HConstants.CATALOG_FAMILY:HConstants.REGIONINFO_QUALIFIER of the catalog table Result.- Parameters:
- data- a Result object from the catalog table scan
- Returns:
- RegionInfo or null
 
- 
getRegionLocationReturns the HRegionLocation parsed from the given meta row Result for the given regionInfo and replicaId. The regionInfo can be the default region info for the replica.- Parameters:
- r- the meta row result
- regionInfo- RegionInfo for default replica
- replicaId- the replicaId for the HRegionLocation
- Returns:
- HRegionLocation parsed from the given meta row Result for the given replicaId
 
- 
getRegionLocationsReturns an HRegionLocationList extracted from the result.- Returns:
- an HRegionLocationList containing all locations for the region range or null if we can't deserialize the result.
 
- 
getServerNameReturns aServerNamefrom catalog tableResult.- Parameters:
- r- Result to pull from
- Returns:
- A ServerName instance or null if necessary fields not found or empty.
 
- 
getServerColumnReturns the column qualifier for server column for replicaId- Parameters:
- replicaId- the replicaId of the region
- Returns:
- a byte[] for server column qualifier
 
- 
getStartCodeColumnReturns the column qualifier for server start code column for replicaId- Parameters:
- replicaId- the replicaId of the region
- Returns:
- a byte[] for server start code column qualifier
 
- 
getSeqNumDuringOpenThe latest seqnum that the server writing to meta observed when opening the region. E.g. the seqNum when the result ofgetServerName(org.apache.hadoop.hbase.client.Result,int)was written.- Parameters:
- r- Result to pull the seqNum from
- Returns:
- SeqNum, or HConstants.NO_SEQNUM if there's no value written.
 
- 
getSeqNumColumnReturns the column qualifier for seqNum column for replicaId- Parameters:
- replicaId- the replicaId of the region
- Returns:
- a byte[] for seqNum column qualifier
 
- 
parseReplicaIdFromServerColumnParses the replicaId from the server column qualifier. See top of the class javadoc for the actual meta layout- Parameters:
- serverColumn- the column qualifier
- Returns:
- an int for the replicaId
 
- 
getMetaKeyForRegionReturns the row key to use for this regionInfo
- 
getRegionStateColumnReturns the column qualifier for serialized region state- Parameters:
- replicaId- the replicaId of the region
- Returns:
- a byte[] for state qualifier
 
- 
getServerNameColumnReturns the column qualifier for serialized region state- Parameters:
- replicaId- the replicaId of the region
- Returns:
- a byte[] for sn column qualifier
 
- 
getTableStateDecode table state from META Result. Should contain cell from HConstants.TABLE_FAMILY- Returns:
- null if not found
- Throws:
- IOException
 
- 
getMergeRegionsWithNameReturns Deserialized values of <qualifier,regioninfo> pairs taken from column values that match the regex 'info:merge.*' in array ofcells.
- 
getMergeRegionsReturns Deserialized regioninfo values taken from column values that match the regex 'info:merge.*' in array ofcells.
- 
hasMergeRegionsReturns True if any merge regions present incells; i.e. the column incellmatches the regex 'info:merge.*'.
- 
isMergeQualifierPrefixReturns True if the column incellmatches the regex 'info:merge.*'.
 
-