Class RegionStateStore
java.lang.Object
org.apache.hadoop.hbase.master.assignment.RegionStateStore
Store Region State to hbase:meta table.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
private final MasterServices
private final MasterRegion
protected static final char
The delimiter for meta columns for replicaIds > 0private static final org.slf4j.Logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) static Put
addMergeRegions
(Put put, Collection<RegionInfo> mergeRegions) private static Put
addSequenceNum
(Put p, long openSeqNum, int replicaId) private static void
private static void
debugLogMutations
(List<? extends Mutation> mutations) void
deleteMergeQualifiers
(RegionInfo mergeRegion) Deletes merge qualifiers for the specified merge region.void
deleteRegion
(RegionInfo regionInfo) Deletes the specified region.deleteRegionReplicas
(ResultScanner scanner, int oldReplicaCount, int newReplicaCount, long now) void
deleteRegions
(List<RegionInfo> regions) Deletes the specified regions.private void
deleteRegions
(List<RegionInfo> regions, long ts) private Put
generateUpdateRegionLocationPut
(RegionStateNode regionStateNode) private TableDescriptor
getDescriptor
(TableName tableName) getMergeRegions
(RegionInfo region) Returns Return all regioninfos listed in the 'info:merge*' columns of the givenregion
.private Table
private long
private Result
getRegionCatalogResult
(RegionInfo region) private int
static RegionState.State
getRegionState
(Result r, RegionInfo regionInfo) Pull the region state from a catalog tableResult
.private Scan
getScanForUpdateRegionReplicas
(TableName tableName) static byte[]
getStateColumn
(int replicaId) private boolean
private boolean
hasGlobalReplicationScope
(TableName tableName) boolean
hasMergeRegions
(RegionInfo region) Check whether the givenregion
has any 'info:merge*' columns.void
mergeRegions
(RegionInfo child, RegionInfo[] parents, ServerName serverName, TableDescriptor htd) private void
mirrorMetaLocation
(RegionInfo regionInfo, ServerName serverName, RegionState.State state) private void
multiMutate
(RegionInfo ri, List<Mutation> mutations) Performs an atomic multi-mutate operation against the given table.void
overwriteRegions
(List<RegionInfo> regionInfos, int regionReplication) Overwrites the specified regions from hbase:meta.private void
removeMirrorMetaLocation
(int oldReplicaCount, int newReplicaCount) void
removeRegionReplicas
(TableName tableName, int oldReplicaCount, int newReplicaCount) void
splitRegion
(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) void
static void
visitMetaEntry
(RegionStateStore.RegionStateVisitor visitor, Result result) void
visitMetaForRegion
(String regionEncodedName, RegionStateStore.RegionStateVisitor visitor) Queries META table for the passed region encoded name, delegating action upon results to theRegionStateVisitor
passed 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 theRegionStateVisitor
passed as second parameter.- Parameters:
regionEncodedName
- encoded name for the Region we want to query META for.visitor
- TheRegionStateVisitor
instance 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 givenregion
has 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
-