Class RegionStateStore
java.lang.Object
org.apache.hadoop.hbase.master.assignment.RegionStateStore
Store Region State to hbase:meta table.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate final MasterServicesprivate final MasterRegionprotected static final charThe delimiter for meta columns for replicaIds > 0private static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static PutaddMergeRegions(Put put, Collection<RegionInfo> mergeRegions) private static PutaddSequenceNum(Put p, long openSeqNum, int replicaId) private static voidprivate static voiddebugLogMutations(List<? extends Mutation> mutations) voiddeleteMergeQualifiers(RegionInfo mergeRegion) Deletes merge qualifiers for the specified merge region.voiddeleteRegion(RegionInfo regionInfo) Deletes the specified region.deleteRegionReplicas(ResultScanner scanner, int oldReplicaCount, int newReplicaCount, long now) voiddeleteRegions(List<RegionInfo> regions) Deletes the specified regions.private voiddeleteRegions(List<RegionInfo> regions, long ts) private PutgenerateUpdateRegionLocationPut(RegionStateNode regionStateNode) private TableDescriptorgetDescriptor(TableName tableName) getMergeRegions(RegionInfo region) Returns Return all regioninfos listed in the 'info:merge*' columns of the givenregion.private Tableprivate longprivate ResultgetRegionCatalogResult(RegionInfo region) private intstatic RegionState.StategetRegionState(Result r, RegionInfo regionInfo) Pull the region state from a catalog tableResult.private ScangetScanForUpdateRegionReplicas(TableName tableName) static byte[]getStateColumn(int replicaId) private booleanprivate booleanhasGlobalReplicationScope(TableName tableName) booleanhasMergeRegions(RegionInfo region) Check whether the givenregionhas any 'info:merge*' columns.voidmergeRegions(RegionInfo child, RegionInfo[] parents, ServerName serverName, TableDescriptor htd) private voidmirrorMetaLocation(RegionInfo regionInfo, ServerName serverName, RegionState.State state) private voidmultiMutate(RegionInfo ri, List<Mutation> mutations) Performs an atomic multi-mutate operation against the given table.voidoverwriteRegions(List<RegionInfo> regionInfos, int regionReplication) Overwrites the specified regions from hbase:meta.private voidremoveMirrorMetaLocation(int oldReplicaCount, int newReplicaCount) voidremoveRegionReplicas(TableName tableName, int oldReplicaCount, int newReplicaCount) voidsplitRegion(RegionInfo parent, RegionInfo splitA, RegionInfo splitB, ServerName serverName, TableDescriptor htd) Splits the region into two in an atomic operation.private CompletableFuture<Void>updateRegionLocation(RegionInfo regionInfo, RegionState.State state, Put put) (package private) CompletableFuture<Void>updateRegionLocation(RegionStateNode regionStateNode) voidstatic voidvisitMetaEntry(RegionStateStore.RegionStateVisitor visitor, Result result) voidvisitMetaForRegion(String regionEncodedName, RegionStateStore.RegionStateVisitor visitor) Queries META table for the passed region encoded name, delegating action upon results to theRegionStateVisitorpassed as second parameter.
-
Field Details
-
LOG
-
METALOG
-
META_REPLICA_ID_DELIMITER
The delimiter for meta columns for replicaIds > 0- See Also:
-
master
-
masterRegion
-
-
Constructor Details
-
RegionStateStore
-
-
Method Details
-
visitMeta
- Throws:
IOException
-
visitMetaForRegion
public void visitMetaForRegion(String regionEncodedName, RegionStateStore.RegionStateVisitor visitor) throws IOException Queries META table for the passed region encoded name, delegating action upon results to theRegionStateVisitorpassed as second parameter.- Parameters:
regionEncodedName- encoded name for the Region we want to query META for.visitor- TheRegionStateVisitorinstance to react over the query results.- Throws:
IOException- If some error occurs while querying META or parsing results.
-
visitMetaEntry
public static void visitMetaEntry(RegionStateStore.RegionStateVisitor visitor, Result result) throws IOException - Throws:
IOException
-
generateUpdateRegionLocationPut
- Throws:
IOException
-
updateRegionLocation
-
mirrorMetaLocation
private void mirrorMetaLocation(RegionInfo regionInfo, ServerName serverName, RegionState.State state) throws IOException - Throws:
IOException
-
removeMirrorMetaLocation
- Throws:
IOException
-
updateRegionLocation
private CompletableFuture<Void> updateRegionLocation(RegionInfo regionInfo, RegionState.State state, Put put) -
getOpenSeqNumForParentRegion
- Throws:
IOException
-
multiMutate
Performs an atomic multi-mutate operation against the given table. Used by the likes of merge and split as these want to make atomic mutations across multiple rows.- Throws:
IOException
-
getMetaTable
- Throws:
IOException
-
getRegionCatalogResult
- Throws:
IOException
-
addSequenceNum
- Throws:
IOException
-
splitRegion
public void splitRegion(RegionInfo parent, RegionInfo splitA, RegionInfo splitB, ServerName serverName, TableDescriptor htd) throws IOException Splits the region into two in an atomic operation. Offlines the parent region with the information that it is split into two, and also adds the daughter regions. Does not add the location information to the daughter regions since they are not open yet.- Throws:
IOException
-
mergeRegions
public void mergeRegions(RegionInfo child, RegionInfo[] parents, ServerName serverName, TableDescriptor htd) throws IOException - Throws:
IOException
-
hasMergeRegions
Check whether the givenregionhas any 'info:merge*' columns.- Throws:
IOException
-
getMergeRegions
Returns Return all regioninfos listed in the 'info:merge*' columns of the givenregion.- Throws:
IOException
-
deleteMergeQualifiers
Deletes merge qualifiers for the specified merge region.- Parameters:
connection- connection we're usingmergeRegion- the merged region- Throws:
IOException
-
addMergeRegions
- Throws:
IOException
-
deleteRegion
Deletes the specified region.- Throws:
IOException
-
deleteRegions
Deletes the specified regions.- Throws:
IOException
-
deleteRegions
- Throws:
IOException
-
overwriteRegions
public void overwriteRegions(List<RegionInfo> regionInfos, int regionReplication) throws IOException Overwrites the specified regions from hbase:meta. Deletes old rows for the given regions and adds new ones. Regions added back have state CLOSED.- Parameters:
connection- connection we're usingregionInfos- list of regions to be added to META- Throws:
IOException
-
getScanForUpdateRegionReplicas
-
deleteRegionReplicas
private List<Delete> deleteRegionReplicas(ResultScanner scanner, int oldReplicaCount, int newReplicaCount, long now) throws IOException - Throws:
IOException
-
removeRegionReplicas
public void removeRegionReplicas(TableName tableName, int oldReplicaCount, int newReplicaCount) throws IOException - Throws:
IOException
-
hasGlobalReplicationScope
- Throws:
IOException
-
hasGlobalReplicationScope
-
getRegionReplication
-
getDescriptor
- Throws:
IOException
-
getRegionState
Pull the region state from a catalog tableResult.- Returns:
- the region state, or null if unknown.
-
getStateColumn
-
debugLogMutations
- Throws:
IOException
-
debugLogMutation
- Throws:
IOException
-