@InterfaceAudience.Private public class UnassignProcedure extends RegionTransitionProcedure
The Unassign starts by placing a "close region" request in the Remote Dispatcher queue, and the procedure will then go into a "waiting state" (suspend). 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 this procedure. The procedure will wakeup and finish the unassign by publishing its new state on meta.
If we are unable to contact the remote regionserver whether because of ConnectException or socket timeout, we will call expire on the server we were trying to contact. We will remain in suspended state waiting for a wake up from the ServerCrashProcedure that is processing the failed server. The basic idea is that if we notice a crashed server, then we have a responsibility; i.e. we should not let go of the region until we are sure the server that was hosting has had its crash processed. If we let go of the region before then, an assign might run before the logs have been split which would make for data loss.
TODO: Rather than this tricky coordination between SCP and this Procedure, instead, work on returning a SCP as our subprocedure; probably needs work on the framework to do this, especially if the SCP already created.
Procedure.LockState
TableProcedureInterface.TableOperationType
Modifier and Type | Field and Description |
---|---|
protected ServerName |
destinationServer
The Server we will subsequently assign the region too (can be null).
|
protected ServerName |
hostingServer
Where to send the unassign RPC.
|
aborted
NO_PROC_ID, NO_TIMEOUT
Constructor and Description |
---|
UnassignProcedure() |
UnassignProcedure(RegionInfo regionInfo,
ServerName hostingServer,
boolean force,
boolean removeAfterUnassigning) |
UnassignProcedure(RegionInfo regionInfo,
ServerName hostingServer,
ServerName destinationServer,
boolean force) |
UnassignProcedure(RegionInfo regionInfo,
ServerName hostingServer,
ServerName destinationServer,
boolean override,
boolean removeAfterUnassigning) |
Modifier and Type | Method and Description |
---|---|
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.
|
protected boolean |
isRollbackSupported(MasterProcedureProtos.RegionTransitionState state) |
protected void |
proceed(MasterProcedureEnv env,
RegionStates.RegionStateNode regionNode)
Set it up so when procedure is unsuspended, we'll move to the procedure finish.
|
RemoteProcedureDispatcher.RemoteOperation |
remoteCallBuild(MasterProcedureEnv env,
ServerName serverName)
For building the remote operation.
|
protected boolean |
remoteCallFailed(MasterProcedureEnv env,
RegionStates.RegionStateNode regionNode,
IOException exception) |
protected void |
reportTransition(MasterProcedureEnv env,
RegionStates.RegionStateNode regionNode,
RegionServerStatusProtos.RegionStateTransition.TransitionCode code,
long seqId) |
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, isServerOnline, isServerOnline, releaseLock, remoteCallFailed, remoteOperationCompleted, remoteOperationFailed, reportTransition, rollback, setAttempt, setOverride, setRegionInfo, setTimeoutFailure, shouldWaitClientAck, storeInDispatchedQueue, 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
protected volatile ServerName hostingServer
protected volatile ServerName destinationServer
public UnassignProcedure()
public UnassignProcedure(RegionInfo regionInfo, ServerName hostingServer, boolean force, boolean removeAfterUnassigning)
public UnassignProcedure(RegionInfo regionInfo, ServerName hostingServer, ServerName destinationServer, boolean force)
public UnassignProcedure(RegionInfo regionInfo, ServerName hostingServer, ServerName destinationServer, boolean override, boolean removeAfterUnassigning)
public TableProcedureInterface.TableOperationType getTableOperationType()
TableProcedureInterface
protected boolean isRollbackSupported(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
protected boolean startTransition(MasterProcedureEnv env, RegionStates.RegionStateNode regionNode)
startTransition
in class RegionTransitionProcedure
protected boolean updateTransition(MasterProcedureEnv env, RegionStates.RegionStateNode regionNode) throws IOException
RegionTransitionProcedure
updateTransition
in class RegionTransitionProcedure
IOException
protected void finishTransition(MasterProcedureEnv env, RegionStates.RegionStateNode regionNode) throws IOException
finishTransition
in class RegionTransitionProcedure
IOException
public RemoteProcedureDispatcher.RemoteOperation remoteCallBuild(MasterProcedureEnv env, ServerName serverName)
RemoteProcedureDispatcher.RemoteProcedure
remoteCallBuild
in interface RemoteProcedureDispatcher.RemoteProcedure<MasterProcedureEnv,ServerName>
remoteCallBuild
in class RegionTransitionProcedure
protected void reportTransition(MasterProcedureEnv env, RegionStates.RegionStateNode regionNode, RegionServerStatusProtos.RegionStateTransition.TransitionCode code, long seqId) throws UnexpectedStateException
reportTransition
in class RegionTransitionProcedure
UnexpectedStateException
protected void proceed(MasterProcedureEnv env, RegionStates.RegionStateNode regionNode)
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 Cloudera. All rights reserved.