@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.LockStateTableProcedureInterface.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.
|
abortedNO_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 force,
boolean removeAfterUnassigning) |
abort, acquireLock, addToRemoteDispatcher, execute, getAttempt, getRegionInfo, getRegionState, getTableName, hasLock, holdLock, isMeta, isServerOnline, isServerOnline, releaseLock, remoteCallCompleted, remoteCallFailed, reportTransition, rollback, setAttempt, setRegionInfo, setTimeoutFailure, shouldWaitClientAck, toStringStateaddStackIndex, afterReplay, beforeReplay, compareTo, completionCleanup, doAcquireLock, doExecute, doReleaseLock, doRollback, elapsedTime, getChildrenLatch, getException, getLastUpdate, getNonceKey, getOwner, getParentProcId, getProcId, getProcIdHashCode, getProcName, getResult, getRootProcedureId, getRootProcId, getStackIndexes, getState, getSubmittedTime, getTimeout, getTimeoutTimestamp, hasChildren, hasException, hasOwner, hasParent, hasTimeout, haveSameParent, incChildrenLatch, isFailed, isFinished, isInitializing, isRunnable, isSuccess, isWaiting, isYieldAfterExecutionStep, removeStackIndex, setAbortFailure, setChildrenLatch, setFailure, setFailure, setLastUpdate, setNonceKey, setOwner, setOwner, setParentProcId, setProcId, setResult, setRootProcId, setStackIndexes, setState, setSubmittedTime, setTimeout, toString, toStringClass, toStringDetails, toStringSimpleSB, updateMetricsOnFinish, updateMetricsOnSubmit, updateTimestamp, wasExecutedprotected 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 force, boolean removeAfterUnassigning)
public TableProcedureInterface.TableOperationType getTableOperationType()
TableProcedureInterfaceprotected boolean isRollbackSupported(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RegionTransitionState state)
isRollbackSupported in class RegionTransitionProcedureprotected void serializeStateData(ProcedureStateSerializer serializer) throws IOException
serializeStateData in class Procedure<MasterProcedureEnv>IOExceptionprotected void deserializeStateData(ProcedureStateSerializer serializer) throws IOException
deserializeStateData in class Procedure<MasterProcedureEnv>IOExceptionprotected boolean startTransition(MasterProcedureEnv env, RegionStates.RegionStateNode regionNode)
startTransition in class RegionTransitionProcedureprotected boolean updateTransition(MasterProcedureEnv env, RegionStates.RegionStateNode regionNode) throws IOException
RegionTransitionProcedureupdateTransition in class RegionTransitionProcedureIOExceptionprotected void finishTransition(MasterProcedureEnv env, RegionStates.RegionStateNode regionNode) throws IOException
finishTransition in class RegionTransitionProcedureIOExceptionpublic RemoteProcedureDispatcher.RemoteOperation remoteCallBuild(MasterProcedureEnv env, ServerName serverName)
remoteCallBuild in interface RemoteProcedureDispatcher.RemoteProcedure<MasterProcedureEnv,ServerName>remoteCallBuild in class RegionTransitionProcedureprotected void reportTransition(MasterProcedureEnv env, RegionStates.RegionStateNode regionNode, org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode code, long seqId) throws UnexpectedStateException
reportTransition in class RegionTransitionProcedureUnexpectedStateExceptionprotected boolean remoteCallFailed(MasterProcedureEnv env, RegionStates.RegionStateNode regionNode, IOException exception)
remoteCallFailed in class RegionTransitionProcedurepublic void toStringClassDetails(StringBuilder sb)
toStringClassDetails in class RegionTransitionProcedurepublic ServerName getServer(MasterProcedureEnv env)
RegionTransitionProceduregetServer in class RegionTransitionProcedureprotected ProcedureMetrics getProcedureMetrics(MasterProcedureEnv env)
getProcedureMetrics in class Procedure<MasterProcedureEnv>Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.