@InterfaceAudience.Private public class AssignProcedure extends RegionTransitionProcedure
The Assign starts by pushing the "assign" operation to the AssignmentManager and then will go in a "waiting" state. The AM will batch the "assign" requests and ask the Balancer where to put the region (the various policies will be respected: retain, round-robin, random). Once the AM and the balancer have found a place for the region the procedure will be resumed and an "open region" request will be placed in the Remote Dispatcher queue, and the procedure once again will go in a "waiting state". The Remote Dispatcher will batch the various requests for that server and they will be sent to the RS for execution. The RS will complete the open operation by calling master.reportRegionStateTransition(). The AM will intercept the transition report, and notify the procedure. The procedure will finish the assignment by publishing to new state on meta or it will retry the assignment.
This procedure does not rollback when beyond the first REGION_TRANSITION_QUEUE step; it will press on trying to assign in the face of failure. Should we ignore rollback calls to Assign/Unassign then? Or just remove rollback here?
Modifier and Type | Class and Description |
---|---|
static class |
AssignProcedure.CompareAssignProcedure
Sort AssignProcedures such that meta and system assigns come first before user-space assigns.
|
Procedure.LockState
TableProcedureInterface.TableOperationType
Modifier and Type | Field and Description |
---|---|
static AssignProcedure.CompareAssignProcedure |
COMPARATOR
Comparator that will sort AssignProcedures so meta assigns come first, then system table
assigns and finally user space assigns.
|
private boolean |
forceNewPlan
Set to true when we need recalibrate -- choose a new target -- because original assign failed.
|
private static org.slf4j.Logger |
LOG |
protected ServerName |
targetServer
Gets set as desired target on move, merge, etc., when we want to go to a particular server.
|
aborted
NO_PROC_ID, NO_TIMEOUT
Constructor and Description |
---|
AssignProcedure() |
AssignProcedure(RegionInfo regionInfo) |
AssignProcedure(RegionInfo regionInfo,
ServerName destinationServer) |
AssignProcedure(RegionInfo regionInfo,
ServerName destinationServer,
boolean override) |
Modifier and Type | Method and Description |
---|---|
static boolean |
assign(MasterServices masterServices,
RegionInfo ri)
Used by ServerCrashProcedure too skip creating Assigns if not needed.
|
protected static boolean |
assign(MasterServices masterServices,
RegionStates.RegionStateNode regionNode) |
protected void |
deserializeStateData(ProcedureStateSerializer serializer)
Called on store load to allow the user to decode the previously serialized
state.
|
protected void |
finishTransition(MasterProcedureEnv env,
RegionStates.RegionStateNode regionNode) |
protected ProcedureMetrics |
getProcedureMetrics(MasterProcedureEnv env)
Override this method to provide procedure specific counters for submitted count, failed
count and time histogram.
|
ServerName |
getServer(MasterProcedureEnv env)
Used by ServerCrashProcedure to see if this Assign/Unassign needs processing.
|
TableProcedureInterface.TableOperationType |
getTableOperationType()
Given an operation type we can take decisions about what to do with pending operations.
|
private void |
handleFailure(MasterProcedureEnv env,
RegionStates.RegionStateNode regionNode)
Called when dispatch or subsequent OPEN request fail.
|
private boolean |
incrementAndCheckMaxAttempts(MasterProcedureEnv env,
RegionStates.RegionStateNode regionNode) |
protected boolean |
isRollbackSupported(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RegionTransitionState state) |
RemoteProcedureDispatcher.RemoteOperation |
remoteCallBuild(MasterProcedureEnv env,
ServerName serverName) |
protected boolean |
remoteCallFailed(MasterProcedureEnv env,
RegionStates.RegionStateNode regionNode,
IOException exception) |
protected void |
reportTransition(MasterProcedureEnv env,
RegionStates.RegionStateNode regionNode,
org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode code,
long openSeqNum) |
protected void |
serializeStateData(ProcedureStateSerializer serializer)
The user-level code of the procedure may have some state to
persist (e.g.
|
protected boolean |
startTransition(MasterProcedureEnv env,
RegionStates.RegionStateNode regionNode) |
void |
toStringClassDetails(StringBuilder sb)
Extend the toString() information with the procedure details
e.g.
|
protected boolean |
updateTransition(MasterProcedureEnv env,
RegionStates.RegionStateNode regionNode)
Called when the Procedure is in the REGION_TRANSITION_DISPATCH state.
|
abort, acquireLock, addToRemoteDispatcher, bypass, execute, getAttempt, getRegionInfo, getRegionState, getTableName, getTransitionState, holdLock, isMeta, isOverride, isServerOnline, isServerOnline, releaseLock, remoteCallCompleted, remoteCallFailed, reportTransition, rollback, setAttempt, setOverride, setRegionInfo, setTimeoutFailure, setTransitionState, shouldWaitClientAck, toStringState, waitInitialized
addStackIndex, afterReplay, beforeReplay, compareTo, completionCleanup, doExecute, doRollback, elapsedTime, getChildrenLatch, getException, getLastUpdate, getNonceKey, getOwner, getParentProcId, getProcId, getProcIdHashCode, getProcName, getResult, getRootProcedureId, getRootProcId, getStackIndexes, getState, getSubmittedTime, getTimeout, getTimeoutTimestamp, hasChildren, hasException, hasLock, hasOwner, hasParent, hasTimeout, haveSameParent, incChildrenLatch, isBypass, isFailed, isFinished, isInitializing, isLockedWhenLoading, isRunnable, isSuccess, isWaiting, isYieldAfterExecutionStep, removeStackIndex, setAbortFailure, setChildrenLatch, setFailure, setFailure, setLastUpdate, setNonceKey, setOwner, setOwner, setParentProcId, setProcId, setResult, setRootProcId, setStackIndexes, setState, setSubmittedTime, setTimeout, skipPersistence, toString, toStringClass, toStringDetails, toStringSimpleSB, updateMetricsOnFinish, updateMetricsOnSubmit, updateTimestamp, wasExecuted
private static final org.slf4j.Logger LOG
private boolean forceNewPlan
protected volatile ServerName targetServer
public static final AssignProcedure.CompareAssignProcedure COMPARATOR
public AssignProcedure()
public AssignProcedure(RegionInfo regionInfo)
public AssignProcedure(RegionInfo regionInfo, ServerName destinationServer)
public AssignProcedure(RegionInfo regionInfo, ServerName destinationServer, boolean override)
public TableProcedureInterface.TableOperationType getTableOperationType()
TableProcedureInterface
protected boolean isRollbackSupported(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RegionTransitionState state)
isRollbackSupported
in class RegionTransitionProcedure
protected void serializeStateData(ProcedureStateSerializer serializer) throws IOException
Procedure
serializeStateData
in class Procedure<MasterProcedureEnv>
serializer
- stores the serializable stateIOException
protected void deserializeStateData(ProcedureStateSerializer serializer) throws IOException
Procedure
deserializeStateData
in class Procedure<MasterProcedureEnv>
serializer
- contains the serialized stateIOException
public static boolean assign(MasterServices masterServices, RegionInfo ri)
protected static boolean assign(MasterServices masterServices, RegionStates.RegionStateNode regionNode) throws IOException
IOException
protected boolean startTransition(MasterProcedureEnv env, RegionStates.RegionStateNode regionNode) throws IOException
startTransition
in class RegionTransitionProcedure
IOException
protected boolean updateTransition(MasterProcedureEnv env, RegionStates.RegionStateNode regionNode) throws IOException, ProcedureSuspendedException
RegionTransitionProcedure
updateTransition
in class RegionTransitionProcedure
IOException
ProcedureSuspendedException
protected void finishTransition(MasterProcedureEnv env, RegionStates.RegionStateNode regionNode) throws IOException
finishTransition
in class RegionTransitionProcedure
IOException
protected void reportTransition(MasterProcedureEnv env, RegionStates.RegionStateNode regionNode, org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode code, long openSeqNum) throws UnexpectedStateException
reportTransition
in class RegionTransitionProcedure
UnexpectedStateException
private void handleFailure(MasterProcedureEnv env, RegionStates.RegionStateNode regionNode)
private boolean incrementAndCheckMaxAttempts(MasterProcedureEnv env, RegionStates.RegionStateNode regionNode)
public RemoteProcedureDispatcher.RemoteOperation remoteCallBuild(MasterProcedureEnv env, ServerName serverName)
remoteCallBuild
in interface RemoteProcedureDispatcher.RemoteProcedure<MasterProcedureEnv,ServerName>
remoteCallBuild
in class RegionTransitionProcedure
protected boolean remoteCallFailed(MasterProcedureEnv env, RegionStates.RegionStateNode regionNode, IOException exception)
remoteCallFailed
in class RegionTransitionProcedure
public void toStringClassDetails(StringBuilder sb)
Procedure
toStringClassDetails
in class RegionTransitionProcedure
sb
- the string builder to use to append the proc specific informationpublic ServerName getServer(MasterProcedureEnv env)
RegionTransitionProcedure
getServer
in class RegionTransitionProcedure
protected ProcedureMetrics getProcedureMetrics(MasterProcedureEnv env)
Procedure
getProcedureMetrics
in class Procedure<MasterProcedureEnv>
env
- The environment passed to the procedure executorCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.