@InterfaceAudience.Private public class AssignmentManager extends Object
RegionStates
.RegionStateStore
.Modifier and Type | Class and Description |
---|---|
private static class |
AssignmentManager.DeadServerMetricRegionChore |
private static class |
AssignmentManager.RegionInTransitionChore |
static class |
AssignmentManager.RegionInTransitionStat |
private class |
AssignmentManager.RegionMetaLoadingVisitor |
Constructor and Description |
---|
AssignmentManager(MasterServices master,
MasterRegion masterRegion) |
AssignmentManager(MasterServices master,
MasterRegion masterRegion,
RegionStateStore stateStore) |
Modifier and Type | Method and Description |
---|---|
private void |
acceptPlan(HashMap<RegionInfo,RegionStateNode> regions,
Map<ServerName,List<RegionInfo>> plan) |
private void |
addToPendingAssignment(HashMap<RegionInfo,RegionStateNode> regions,
Collection<RegionInfo> pendingRegions) |
long |
assign(RegionInfo regionInfo) |
long |
assign(RegionInfo regionInfo,
ServerName sn) |
Future<byte[]> |
assignAsync(RegionInfo regionInfo)
Submits a procedure that assigns a region without waiting for it to finish
|
Future<byte[]> |
assignAsync(RegionInfo regionInfo,
ServerName sn)
Submits a procedure that assigns a region to a target server without waiting for it to finish
|
private void |
assignQueueSignal() |
Future<byte[]> |
balance(RegionPlan regionPlan) |
void |
checkIfShouldMoveSystemRegionAsync()
Start a new thread to check if there are region servers whose versions are higher than others.
|
private void |
checkMetaLoaded(RegionInfo hri)
Used to check if the meta loading is done.
|
private void |
checkOnlineRegionsReport(ServerStateNode serverNode,
Set<byte[]> regionNames)
Check that what the RegionServer reports aligns with the Master's image.
|
private void |
closeRegionSilently(ServerName sn,
byte[] regionName)
Close
regionName on sn silently and immediately without using a
Procedure or going via hbase:meta. |
(package private) static int |
compare(TransitRegionStateProcedure left,
TransitRegionStateProcedure right) |
AssignmentManager.RegionInTransitionStat |
computeRegionInTransitionStat() |
private boolean |
containsBogusAssignments(Map<RegionInfo,RegionStateNode> regions,
List<RegionInfo> hirs) |
private TransitRegionStateProcedure |
createAssignProcedure(RegionInfo regionInfo,
ServerName sn,
boolean override)
Create an assign TransitRegionStateProcedure.
|
private TransitRegionStateProcedure |
createAssignProcedure(RegionStateNode regionNode,
ServerName targetServer)
Create an assign TransitRegionStateProcedure.
|
TransitRegionStateProcedure[] |
createAssignProcedures(List<RegionInfo> hris)
Create an array of TransitRegionStateProcedure w/o specifying a target server.
|
private TransitRegionStateProcedure[] |
createAssignProcedures(Map<ServerName,List<RegionInfo>> assignments)
Tied to
createAssignProcedures(List) in that it is called if caller is unable to run
this method. |
MergeTableRegionsProcedure |
createMergeProcedure(RegionInfo... ris) |
TransitRegionStateProcedure |
createMoveRegionProcedure(RegionInfo regionInfo,
ServerName targetServer) |
TransitRegionStateProcedure |
createOneAssignProcedure(RegionInfo ri,
boolean override)
Create one TransitRegionStateProcedure to assign a region w/o specifying a target server.
|
TransitRegionStateProcedure |
createOneUnassignProcedure(RegionInfo ri,
boolean override)
Create one TransitRegionStateProcedure to unassign a region.
|
TransitRegionStateProcedure[] |
createRoundRobinAssignProcedures(List<RegionInfo> hris)
Create round-robin assigns.
|
TransitRegionStateProcedure[] |
createRoundRobinAssignProcedures(List<RegionInfo> hris,
List<ServerName> serversToExclude)
Create round-robin assigns.
|
SplitTableRegionProcedure |
createSplitProcedure(RegionInfo regionToSplit,
byte[] splitKey) |
TransitRegionStateProcedure[] |
createUnassignProceduresForClosingExcessRegionReplicas(TableName tableName,
int newReplicaCount)
Called by ModifyTableProcedures to unassign all the excess region replicas for a table.
|
TransitRegionStateProcedure[] |
createUnassignProceduresForDisabling(TableName tableName)
Called by DisableTableProcedure to unassign all the regions for a table.
|
void |
deleteTable(TableName tableName)
Delete the region states.
|
private TransitRegionStateProcedure |
forceCreateUnssignProcedure(RegionStateNode regionNode) |
List<RegionInfo> |
getAssignedRegions() |
(package private) int |
getAssignMaxAttempts() |
MetricsAssignmentManager |
getAssignmentManagerMetrics() |
(package private) int |
getAssignRetryImmediatelyMaxAttempts() |
private LoadBalancer |
getBalancer() |
org.apache.hadoop.conf.Configuration |
getConfiguration() |
List<ServerName> |
getExcludedServersForSystemTable()
For a given cluster with mixed versions of servers, get a list of servers with lower versions,
where system table regions should not be assigned to.
|
List<ServerName> |
getFavoredNodes(RegionInfo regionInfo) |
(package private) MasterServices |
getMaster() |
private ProcedureEvent<?> |
getMetaAssignEvent(RegionInfo metaRegionInfo) |
private RegionInfo |
getMetaForRegion(RegionInfo regionInfo) |
RegionInfo |
getMetaRegionFromName(byte[] regionName) |
Set<RegionInfo> |
getMetaRegionSet() |
int |
getNumRegionsOpened() |
private MasterProcedureEnv |
getProcedureEnvironment() |
private MasterProcedureScheduler |
getProcedureScheduler() |
RegionInfo |
getRegionInfo(byte[] regionName) |
private RegionInfo |
getRegionInfo(RegionStateNode rsn) |
List<RegionStateNode> |
getRegionsInTransition() |
List<RegionInfo> |
getRegionsOnServer(ServerName serverName)
Returns the regions hosted by the specified server.
|
private Stream<RegionStateNode> |
getRegionStateNodes(TableName tableName,
boolean excludeOfflinedSplitParents) |
RegionStates |
getRegionStates() |
RegionStatesCount |
getRegionStatesCount(TableName tableName)
Provide regions state count for given table.
|
RegionStateStore |
getRegionStateStore() |
Pair<Integer,Integer> |
getReopenStatus(TableName tableName)
Used by the client (via master) to identify if all regions have the schema updates
|
Map<ServerName,Set<byte[]>> |
getRSReports()
Returns a snapshot of rsReports
|
Map<ServerName,List<RegionInfo>> |
getSnapShotOfAssignment(Collection<RegionInfo> regions) |
private List<RegionInfo> |
getSystemTables(ServerName serverName) |
List<RegionInfo> |
getTableRegions(TableName tableName,
boolean excludeOfflinedSplitParents) |
List<Pair<RegionInfo,ServerName>> |
getTableRegionsAndLocations(TableName tableName,
boolean excludeOfflinedSplitParents) |
private TableStateManager |
getTableStateManager() |
private void |
handleRegionOverStuckWarningThreshold(RegionInfo regionInfo) |
boolean |
hasRegionsInTransition() |
boolean |
isCarryingMeta(ServerName serverName) |
private boolean |
isCarryingRegion(ServerName serverName,
RegionInfo regionInfo) |
boolean |
isMetaAssigned()
Notice that, this only means the meta region is available on a RS, but the AM may still be
loading the region states from meta, so usually you need to check
isMetaLoaded() first
before checking this method, unless you can make sure that your piece of code can only be
executed after AM builds the region states. |
boolean |
isMetaLoaded()
Return whether AM finishes the meta loading, i.e, the region states rebuilding.
|
boolean |
isMetaRegion(byte[] regionName) |
private boolean |
isMetaRegion(RegionInfo regionInfo) |
boolean |
isMetaRegionInTransition() |
boolean |
isRunning() |
private boolean |
isTableDisabled(TableName tableName) |
private boolean |
isTableEnabled(TableName tableName) |
void |
joinCluster() |
private void |
loadMeta() |
RegionInfo |
loadRegionFromMeta(String regionEncodedName)
Query META if the given
RegionInfo exists, adding to
AssignmentManager.regionStateStore cache if the region is found in META. |
void |
markRegionAsMerged(RegionInfo child,
ServerName serverName,
RegionInfo[] mergeParents)
When called here, the merge has happened.
|
void |
markRegionAsSplit(RegionInfo parent,
ServerName serverName,
RegionInfo daughterA,
RegionInfo daughterB) |
private void |
mirrorMetaLocations() |
void |
move(RegionInfo regionInfo) |
Future<byte[]> |
moveAsync(RegionPlan regionPlan) |
void |
offlineRegion(RegionInfo regionInfo) |
void |
onlineRegion(RegionInfo regionInfo,
ServerName serverName) |
(package private) void |
persistToMeta(RegionStateNode regionNode) |
private void |
preTransitCheck(RegionStateNode regionNode,
RegionState.State[] expectedStates) |
private void |
processAssignmentPlans(HashMap<RegionInfo,RegionStateNode> regions,
HashMap<RegionInfo,ServerName> retainMap,
List<RegionInfo> hris,
List<ServerName> servers) |
private void |
processAssignQueue() |
void |
processOfflineRegions()
Create assign procedure for offline regions.
|
protected void |
queueAssign(RegionStateNode regionNode)
Add the assign operation to the assignment queue.
|
void |
regionClosedAbnormally(RegionStateNode regionNode) |
(package private) void |
regionClosedWithoutPersistingToMeta(RegionStateNode regionNode) |
(package private) void |
regionClosing(RegionStateNode regionNode) |
(package private) void |
regionFailedOpen(RegionStateNode regionNode,
boolean giveUp) |
(package private) void |
regionOpenedWithoutPersistingToMeta(RegionStateNode regionNode) |
(package private) void |
regionOpening(RegionStateNode regionNode) |
void |
reportOnlineRegions(ServerName serverName,
Set<byte[]> regionNames)
The master will call this method when the RS send the regionServerReport().
|
org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.ReportRegionStateTransitionResponse |
reportRegionStateTransition(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.ReportRegionStateTransitionRequest req) |
private void |
reportRegionStateTransition(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.ReportRegionStateTransitionResponse.Builder builder,
ServerName serverName,
List<org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition> transitionList) |
private boolean |
reportTransition(RegionStateNode regionNode,
ServerStateNode serverNode,
org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode state,
long seqId,
long procId) |
private void |
setMetaAssigned(RegionInfo metaRegionInfo,
boolean assigned) |
void |
setupRIT(List<TransitRegionStateProcedure> procs)
Create RegionStateNode based on the TRSP list, and attach the TRSP to the RegionStateNode.
|
private boolean |
shouldAssignFavoredNodes(RegionInfo region) |
void |
start() |
private void |
startAssignmentThread() |
void |
stop() |
private void |
stopAssignmentThread() |
long |
submitServerCrash(ServerName serverName,
boolean shouldSplitWal,
boolean force)
Usually run by the Master in reaction to server crash during normal processing.
|
private void |
transitStateAndUpdate(RegionStateNode regionNode,
RegionState.State newState,
RegionState.State... expectedStates) |
long |
unassign(RegionInfo regionInfo) |
private void |
updateDeadServerRegionMetrics(int deadRegions,
int unknownRegions) |
private void |
updateRegionMergeTransition(ServerName serverName,
org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode state,
RegionInfo merged,
RegionInfo hriA,
RegionInfo hriB) |
private void |
updateRegionsInTransitionMetrics(AssignmentManager.RegionInTransitionStat ritStat) |
private void |
updateRegionSplitTransition(ServerName serverName,
org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode state,
RegionInfo parent,
RegionInfo hriA,
RegionInfo hriB) |
private void |
updateRegionTransition(ServerName serverName,
org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode state,
RegionInfo regionInfo,
long seqId,
long procId) |
boolean |
waitMetaAssigned(Procedure<?> proc,
RegionInfo regionInfo)
Notice that this event does not mean the AM has already finished region state rebuilding.
|
boolean |
waitMetaLoaded(Procedure<?> proc)
Wait until AM finishes the meta loading, i.e, the region states rebuilding.
|
private HashMap<RegionInfo,RegionStateNode> |
waitOnAssignQueue() |
void |
wakeMetaLoadedEvent()
This method will be called in master initialization method after calling
processOfflineRegions() , as in processOfflineRegions we will generate assign
procedures for offline regions, which may be conflict with creating table. |
private static final org.slf4j.Logger LOG
public static final String BOOTSTRAP_THREAD_POOL_SIZE_CONF_KEY
public static final String ASSIGN_DISPATCH_WAIT_MSEC_CONF_KEY
private static final int DEFAULT_ASSIGN_DISPATCH_WAIT_MSEC
public static final String ASSIGN_DISPATCH_WAITQ_MAX_CONF_KEY
private static final int DEFAULT_ASSIGN_DISPATCH_WAITQ_MAX
public static final String RIT_CHORE_INTERVAL_MSEC_CONF_KEY
private static final int DEFAULT_RIT_CHORE_INTERVAL_MSEC
public static final String DEAD_REGION_METRIC_CHORE_INTERVAL_MSEC_CONF_KEY
private static final int DEFAULT_DEAD_REGION_METRIC_CHORE_INTERVAL_MSEC
public static final String ASSIGN_MAX_ATTEMPTS
private static final int DEFAULT_ASSIGN_MAX_ATTEMPTS
public static final String ASSIGN_RETRY_IMMEDIATELY_MAX_ATTEMPTS
private static final int DEFAULT_ASSIGN_RETRY_IMMEDIATELY_MAX_ATTEMPTS
public static final String METRICS_RIT_STUCK_WARNING_THRESHOLD
private static final int DEFAULT_RIT_STUCK_WARNING_THRESHOLD
public static final String UNEXPECTED_STATE_REGION
private final ProcedureEvent<?> metaAssignEvent
private final ProcedureEvent<?> metaLoadEvent
private final MetricsAssignmentManager metrics
private final AssignmentManager.RegionInTransitionChore ritChore
private final AssignmentManager.DeadServerMetricRegionChore deadMetricChore
private final MasterServices master
private final AtomicBoolean running
private final RegionStates regionStates
private final RegionStateStore regionStateStore
private final String minVersionToMoveSysTables
checkIfShouldMoveSystemRegionAsync()
. Example: Let's assume
the cluster is on version 1.4.0 and we have set "hbase.min.version.move.system.tables" as
"2.0.0". Now if we upgrade one RegionServer on 1.4.0 cluster to 1.6.0 (< 2.0.0), then
AssignmentManager will not move hbase:meta, hbase:namespace and other system table regions to
newly brought up RegionServer 1.6.0 as part of auto-migration. However, if we upgrade one
RegionServer on 1.4.0 cluster to 2.2.0 (> 2.0.0), then AssignmentManager will move all system
table regions to newly brought up RegionServer 2.2.0 as part of auto-migration done by
checkIfShouldMoveSystemRegionAsync()
. "hbase.min.version.move.system.tables" is
introduced as part of HBASE-22923.private static final String MIN_VERSION_MOVE_SYS_TABLES_CONFIG
private static final String DEFAULT_MIN_VERSION_MOVE_SYS_TABLES_CONFIG
private final Map<ServerName,Set<byte[]>> rsReports
private final boolean shouldAssignRegionsWithFavoredNodes
private final int assignDispatchWaitQueueMaxSize
private final int assignDispatchWaitMillis
private final int assignMaxAttempts
private final int assignRetryImmediatelyMaxAttempts
private final MasterRegion masterRegion
private final Object checkIfShouldMoveSystemRegionLock
private Thread assignThread
private static final Set<RegionInfo> META_REGION_SET
private static final RegionState.State[] STATES_EXPECTED_ON_OPEN
private static final RegionState.State[] STATES_EXPECTED_ON_CLOSING
private static final RegionState.State[] STATES_EXPECTED_ON_CLOSED
private static final RegionState.State[] STATES_EXPECTED_ON_ASSIGN
private static final RegionState.State[] STATES_EXPECTED_ON_UNASSIGN_OR_MOVE
private final ArrayList<RegionStateNode> pendingAssignQueue
private final ReentrantLock assignQueueLock
private final Condition assignQueueFullCond
public AssignmentManager(MasterServices master, MasterRegion masterRegion)
AssignmentManager(MasterServices master, MasterRegion masterRegion, RegionStateStore stateStore)
private void mirrorMetaLocations() throws IOException, org.apache.zookeeper.KeeperException
IOException
org.apache.zookeeper.KeeperException
public void start() throws IOException, org.apache.zookeeper.KeeperException
IOException
org.apache.zookeeper.KeeperException
public void setupRIT(List<TransitRegionStateProcedure> procs)
This is used to restore the RIT region list, so we do not need to restore it in the loadingMeta method below. And it is also very important as now before submitting a TRSP, we need to attach it to the RegionStateNode, which acts like a guard, so we need to restore this information at the very beginning, before we start processing any procedures.
public void stop()
public boolean isRunning()
public org.apache.hadoop.conf.Configuration getConfiguration()
public MetricsAssignmentManager getAssignmentManagerMetrics()
private LoadBalancer getBalancer()
private MasterProcedureEnv getProcedureEnvironment()
private MasterProcedureScheduler getProcedureScheduler()
int getAssignMaxAttempts()
int getAssignRetryImmediatelyMaxAttempts()
public RegionStates getRegionStates()
public List<RegionInfo> getRegionsOnServer(ServerName serverName)
private RegionInfo getRegionInfo(RegionStateNode rsn)
private Stream<RegionStateNode> getRegionStateNodes(TableName tableName, boolean excludeOfflinedSplitParents)
public List<RegionInfo> getTableRegions(TableName tableName, boolean excludeOfflinedSplitParents)
public List<Pair<RegionInfo,ServerName>> getTableRegionsAndLocations(TableName tableName, boolean excludeOfflinedSplitParents)
public RegionStateStore getRegionStateStore()
public List<ServerName> getFavoredNodes(RegionInfo regionInfo)
private TableStateManager getTableStateManager()
private boolean isTableEnabled(TableName tableName)
private boolean isTableDisabled(TableName tableName)
private boolean isMetaRegion(RegionInfo regionInfo)
public boolean isMetaRegion(byte[] regionName)
public RegionInfo getMetaRegionFromName(byte[] regionName)
public boolean isCarryingMeta(ServerName serverName)
private boolean isCarryingRegion(ServerName serverName, RegionInfo regionInfo)
private RegionInfo getMetaForRegion(RegionInfo regionInfo)
public Set<RegionInfo> getMetaRegionSet()
public boolean isMetaAssigned()
isMetaLoaded()
first
before checking this method, unless you can make sure that your piece of code can only be
executed after AM builds the region states.isMetaLoaded()
public boolean isMetaRegionInTransition()
public boolean waitMetaAssigned(Procedure<?> proc, RegionInfo regionInfo)
isMetaAssigned()
for more details.isMetaAssigned()
private void setMetaAssigned(RegionInfo metaRegionInfo, boolean assigned)
private ProcedureEvent<?> getMetaAssignEvent(RegionInfo metaRegionInfo)
public boolean waitMetaLoaded(Procedure<?> proc)
public void wakeMetaLoadedEvent()
processOfflineRegions()
, as in processOfflineRegions we will generate assign
procedures for offline regions, which may be conflict with creating table.
This is a bit dirty, should be reconsidered after we decide whether to keep the
processOfflineRegions()
method.public boolean isMetaLoaded()
isMetaAssigned()
,
waitMetaLoaded(Procedure)
public void checkIfShouldMoveSystemRegionAsync()
This method is called when a new RegionServer is added to cluster only.
private List<RegionInfo> getSystemTables(ServerName serverName)
private void preTransitCheck(RegionStateNode regionNode, RegionState.State[] expectedStates) throws HBaseIOException
HBaseIOException
private TransitRegionStateProcedure createAssignProcedure(RegionInfo regionInfo, ServerName sn, boolean override) throws IOException
assign(RegionInfo, ServerName)
and assignAsync(RegionInfo, ServerName)
.override
- If false, check RegionState is appropriate for assign; if not throw exception.IOException
for a version that does NO checking
used when only when no checking needed.
private TransitRegionStateProcedure createAssignProcedure(RegionStateNode regionNode, ServerName targetServer)
public long assign(RegionInfo regionInfo, ServerName sn) throws IOException
IOException
public long assign(RegionInfo regionInfo) throws IOException
IOException
public Future<byte[]> assignAsync(RegionInfo regionInfo, ServerName sn) throws IOException
regionInfo
- the region we would like to assignsn
- target server nameIOException
public Future<byte[]> assignAsync(RegionInfo regionInfo) throws IOException
regionInfo
- the region we would like to assignIOException
public long unassign(RegionInfo regionInfo) throws IOException
IOException
public TransitRegionStateProcedure createMoveRegionProcedure(RegionInfo regionInfo, ServerName targetServer) throws HBaseIOException
HBaseIOException
public void move(RegionInfo regionInfo) throws IOException
IOException
public Future<byte[]> moveAsync(RegionPlan regionPlan) throws HBaseIOException
HBaseIOException
public Future<byte[]> balance(RegionPlan regionPlan) throws HBaseIOException
HBaseIOException
public TransitRegionStateProcedure[] createRoundRobinAssignProcedures(List<RegionInfo> hris, List<ServerName> serversToExclude)
hris
and a call to the balancer
to populate the assigns with targets chosen using round-robin (default balancer
scheme). If at assign-time, the target chosen is no longer up, thats fine, the
AssignProcedure will ask the balancer for a new target, and so on.public TransitRegionStateProcedure[] createRoundRobinAssignProcedures(List<RegionInfo> hris)
hris
and a call to the balancer
to populate the assigns with targets chosen using round-robin (default balancer
scheme). If at assign-time, the target chosen is no longer up, thats fine, the
AssignProcedure will ask the balancer for a new target, and so on.static int compare(TransitRegionStateProcedure left, TransitRegionStateProcedure right)
public TransitRegionStateProcedure createOneAssignProcedure(RegionInfo ri, boolean override)
public TransitRegionStateProcedure createOneUnassignProcedure(RegionInfo ri, boolean override)
public TransitRegionStateProcedure[] createAssignProcedures(List<RegionInfo> hris)
createAssignProcedures(Map)
.
If no target server, at assign time, we will try to use the former location of the region if
one exists. This is how we 'retain' the old location across a server restart.
Should only be called when you can make sure that no one can touch these regions other than
you. For example, when you are creating or enabling table. Presumes all Regions are in
appropriate state ripe for assign; no checking of Region state is done in here.createAssignProcedures(Map)
private TransitRegionStateProcedure[] createAssignProcedures(Map<ServerName,List<RegionInfo>> assignments)
createAssignProcedures(List)
in that it is called if caller is unable to run
this method. Presumes all Regions are in appropriate state ripe for assign; no checking of
Region state is done in here.assignments
- Map of assignments from which we produce an array of AssignProcedures.assignments
createAssignProcedures(List)
private TransitRegionStateProcedure forceCreateUnssignProcedure(RegionStateNode regionNode)
public TransitRegionStateProcedure[] createUnassignProceduresForDisabling(TableName tableName)
public TransitRegionStateProcedure[] createUnassignProceduresForClosingExcessRegionReplicas(TableName tableName, int newReplicaCount)
public SplitTableRegionProcedure createSplitProcedure(RegionInfo regionToSplit, byte[] splitKey) throws IOException
IOException
public MergeTableRegionsProcedure createMergeProcedure(RegionInfo... ris) throws IOException
IOException
public void deleteTable(TableName tableName) throws IOException
IOException
private void reportRegionStateTransition(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.ReportRegionStateTransitionResponse.Builder builder, ServerName serverName, List<org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition> transitionList) throws IOException
IOException
public org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.ReportRegionStateTransitionResponse reportRegionStateTransition(org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.ReportRegionStateTransitionRequest req) throws PleaseHoldException
PleaseHoldException
private void updateRegionTransition(ServerName serverName, org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode state, RegionInfo regionInfo, long seqId, long procId) throws IOException
IOException
private boolean reportTransition(RegionStateNode regionNode, ServerStateNode serverNode, org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode state, long seqId, long procId) throws IOException
IOException
private void updateRegionSplitTransition(ServerName serverName, org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode state, RegionInfo parent, RegionInfo hriA, RegionInfo hriB) throws IOException
IOException
private void updateRegionMergeTransition(ServerName serverName, org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode state, RegionInfo merged, RegionInfo hriA, RegionInfo hriB) throws IOException
IOException
public void reportOnlineRegions(ServerName serverName, Set<byte[]> regionNames)
private void closeRegionSilently(ServerName sn, byte[] regionName)
regionName
on sn
silently and immediately without using a
Procedure or going via hbase:meta. For case where a RegionServer's hosting of a Region is not
aligned w/ the Master's accounting of Region state. This is for cleaning up an error in
accounting.private void checkOnlineRegionsReport(ServerStateNode serverNode, Set<byte[]> regionNames)
public AssignmentManager.RegionInTransitionStat computeRegionInTransitionStat()
private void updateRegionsInTransitionMetrics(AssignmentManager.RegionInTransitionStat ritStat)
private void updateDeadServerRegionMetrics(int deadRegions, int unknownRegions)
private void handleRegionOverStuckWarningThreshold(RegionInfo regionInfo)
public void joinCluster() throws IOException
IOException
public void processOfflineRegions()
public RegionInfo loadRegionFromMeta(String regionEncodedName) throws UnknownRegionException
RegionInfo
exists, adding to
AssignmentManager.regionStateStore
cache if the region is found in META.regionEncodedName
- encoded name for the region to be loaded from META into
AssignmentManager.regionStateStore
cacheRegionInfo
instance for the given region if it is present in META and got
successfully loaded into AssignmentManager.regionStateStore
cache,
null otherwise.UnknownRegionException
- if any errors occur while querying meta.private void loadMeta() throws IOException
IOException
private void checkMetaLoaded(RegionInfo hri) throws PleaseHoldException
hri
- region to check if it is already rebuildPleaseHoldException
- if meta has not been loaded yetpublic int getNumRegionsOpened()
public long submitServerCrash(ServerName serverName, boolean shouldSplitWal, boolean force)
force
- Set if the request came in externally over RPC (via hbck2). Force means run the
SCP even if it seems as though there might be an outstanding SCP running.Procedure.NO_PROC_ID
if none scheduled.public void offlineRegion(RegionInfo regionInfo)
public void onlineRegion(RegionInfo regionInfo, ServerName serverName)
public Map<ServerName,List<RegionInfo>> getSnapShotOfAssignment(Collection<RegionInfo> regions)
public Pair<Integer,Integer> getReopenStatus(TableName tableName)
public boolean hasRegionsInTransition()
public List<RegionStateNode> getRegionsInTransition()
public List<RegionInfo> getAssignedRegions()
public RegionInfo getRegionInfo(byte[] regionName)
private void transitStateAndUpdate(RegionStateNode regionNode, RegionState.State newState, RegionState.State... expectedStates) throws IOException
IOException
void regionOpening(RegionStateNode regionNode) throws IOException
IOException
void regionFailedOpen(RegionStateNode regionNode, boolean giveUp) throws IOException
IOException
void regionClosing(RegionStateNode regionNode) throws IOException
IOException
void regionOpenedWithoutPersistingToMeta(RegionStateNode regionNode) throws IOException
IOException
void regionClosedWithoutPersistingToMeta(RegionStateNode regionNode) throws IOException
IOException
public void regionClosedAbnormally(RegionStateNode regionNode) throws IOException
IOException
void persistToMeta(RegionStateNode regionNode) throws IOException
IOException
public void markRegionAsSplit(RegionInfo parent, ServerName serverName, RegionInfo daughterA, RegionInfo daughterB) throws IOException
IOException
public void markRegionAsMerged(RegionInfo child, ServerName serverName, RegionInfo[] mergeParents) throws IOException
IOException
private boolean shouldAssignFavoredNodes(RegionInfo region)
protected void queueAssign(RegionStateNode regionNode)
private void startAssignmentThread()
private void stopAssignmentThread()
private void assignQueueSignal()
private HashMap<RegionInfo,RegionStateNode> waitOnAssignQueue()
private void processAssignQueue()
private boolean containsBogusAssignments(Map<RegionInfo,RegionStateNode> regions, List<RegionInfo> hirs)
private void processAssignmentPlans(HashMap<RegionInfo,RegionStateNode> regions, HashMap<RegionInfo,ServerName> retainMap, List<RegionInfo> hris, List<ServerName> servers)
private void acceptPlan(HashMap<RegionInfo,RegionStateNode> regions, Map<ServerName,List<RegionInfo>> plan) throws HBaseIOException
HBaseIOException
private void addToPendingAssignment(HashMap<RegionInfo,RegionStateNode> regions, Collection<RegionInfo> pendingRegions)
public List<ServerName> getExcludedServersForSystemTable()
MasterServices getMaster()
public Map<ServerName,Set<byte[]>> getRSReports()
public RegionStatesCount getRegionStatesCount(TableName tableName)
tableName
- TableNameCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.