@InterfaceAudience.Private public abstract class ModifyPeerProcedure extends AbstractPeerProcedure<MasterProcedureProtos.PeerModificationState>
StateMachineProcedure.FlowProcedure.LockStatePeerProcedureInterface.PeerOperationType| Modifier and Type | Field and Description |
|---|---|
protected static int |
SLEEP_INTERVAL_MS |
protected static int |
UPDATE_LAST_SEQ_ID_BATCH_SIZE |
latch, peerIdstateCountNO_PROC_ID, NO_TIMEOUT| Modifier | Constructor and Description |
|---|---|
protected |
ModifyPeerProcedure() |
protected |
ModifyPeerProcedure(String peerId) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
enablePeer(MasterProcedureEnv env) |
protected boolean |
enablePeerBeforeFinish()
The implementation class should override this method if the procedure may enter the serial
related states.
|
protected StateMachineProcedure.Flow |
executeFromState(MasterProcedureEnv env,
MasterProcedureProtos.PeerModificationState state)
called to perform a single step of the specified 'state' of the procedure
|
protected MasterProcedureProtos.PeerModificationState |
getInitialState()
Return the initial state object that will be used for the first call to executeFromState().
|
protected ReplicationPeerConfig |
getNewPeerConfig() |
protected ReplicationPeerConfig |
getOldPeerConfig() |
protected MasterProcedureProtos.PeerModificationState |
getState(int stateId)
Convert an ordinal (or state id) to an Enum (or more descriptive) state object.
|
protected int |
getStateId(MasterProcedureProtos.PeerModificationState state)
Convert the Enum (or more descriptive) state object to an ordinal (or state id).
|
protected MasterProcedureProtos.PeerModificationState |
nextStateAfterRefresh()
Implementation class can override this method.
|
protected abstract void |
postPeerModification(MasterProcedureEnv env)
Called before we finish the procedure.
|
protected abstract void |
prePeerModification(MasterProcedureEnv env)
Called before we start the actual processing.
|
protected void |
reopenRegions(MasterProcedureEnv env) |
protected void |
rollbackState(MasterProcedureEnv env,
MasterProcedureProtos.PeerModificationState state)
called to perform the rollback of the specified state
|
protected void |
setLastPushedSequenceId(MasterProcedureEnv env,
ReplicationPeerConfig peerConfig) |
protected void |
setLastPushedSequenceIdForTable(MasterProcedureEnv env,
TableName tableName,
Map<String,Long> lastSeqIds) |
protected boolean |
setTimeoutFailure(MasterProcedureEnv env)
Called by the ProcedureExecutor when the timeout set by setTimeout() is expired.
|
protected void |
updateLastPushedSequenceIdForSerialPeer(MasterProcedureEnv env) |
protected abstract void |
updatePeerStorage(MasterProcedureEnv env) |
acquireLock, deserializeStateData, getLatch, getPeerId, holdLock, releaseLock, serializeStateData, waitInitializedabort, addChildProcedure, execute, failIfAborted, getCurrentState, getCurrentStateId, getCycles, isEofState, isRollbackSupported, isYieldAfterExecutionStep, isYieldBeforeExecuteFromState, rollback, setNextState, toStringStateaddStackIndex, afterReplay, beforeReplay, bypass, compareTo, completionCleanup, doExecute, doRollback, elapsedTime, getChildrenLatch, getException, getLastUpdate, getNonceKey, getOwner, getParentProcId, getProcedureMetrics, 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, removeStackIndex, setAbortFailure, setChildrenLatch, setFailure, setFailure, setLastUpdate, setNonceKey, setOwner, setOwner, setParentProcId, setProcId, setResult, setRootProcId, setStackIndexes, setState, setSubmittedTime, setTimeout, shouldWaitClientAck, skipPersistence, toString, toStringClass, toStringClassDetails, toStringDetails, toStringSimpleSB, updateMetricsOnFinish, updateMetricsOnSubmit, updateTimestamp, wasExecutedclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetPeerOperationTypeprotected static final int UPDATE_LAST_SEQ_ID_BATCH_SIZE
protected static final int SLEEP_INTERVAL_MS
protected ModifyPeerProcedure()
protected ModifyPeerProcedure(String peerId)
protected abstract void prePeerModification(MasterProcedureEnv env) throws IOException, ReplicationException
If an IOException is thrown then we will give up and mark the procedure as failed directly. If all checks passes then the procedure can not be rolled back any more.
IOExceptionReplicationExceptionprotected abstract void updatePeerStorage(MasterProcedureEnv env) throws ReplicationException
ReplicationExceptionprotected abstract void postPeerModification(MasterProcedureEnv env) throws IOException, ReplicationException
Notice that, since we have already done the actual work, throwing IOException here will
not fail this procedure, we will just ignore it and finish the procedure as suceeded. If
ReplicationException is thrown we will retry since this usually means we fails to
update the peer storage.
IOExceptionReplicationExceptionprotected MasterProcedureProtos.PeerModificationState nextStateAfterRefresh()
protected boolean enablePeerBeforeFinish()
protected ReplicationPeerConfig getOldPeerConfig()
protected ReplicationPeerConfig getNewPeerConfig()
protected void updateLastPushedSequenceIdForSerialPeer(MasterProcedureEnv env) throws IOException, ReplicationException
IOExceptionReplicationExceptionprotected void reopenRegions(MasterProcedureEnv env) throws IOException
IOExceptionprotected void enablePeer(MasterProcedureEnv env) throws ReplicationException
ReplicationExceptionprotected final void setLastPushedSequenceId(MasterProcedureEnv env, ReplicationPeerConfig peerConfig) throws IOException, ReplicationException
IOExceptionReplicationExceptionprotected final void setLastPushedSequenceIdForTable(MasterProcedureEnv env, TableName tableName, Map<String,Long> lastSeqIds) throws IOException, ReplicationException
IOExceptionReplicationExceptionprotected boolean setTimeoutFailure(MasterProcedureEnv env)
ProcedureWAITING_TIMEOUT by calling setState method, and throw a
ProcedureSuspendedException to halt the execution of the procedure, and do not forget a
call Procedure.setTimeout(int) method to set the timeout. And you should also override this
method to wake up the procedure, and also return false to tell the ProcedureExecutor that the
timeout event has been handled.setTimeoutFailure in class Procedure<MasterProcedureEnv>protected StateMachineProcedure.Flow executeFromState(MasterProcedureEnv env, MasterProcedureProtos.PeerModificationState state) throws ProcedureSuspendedException
StateMachineProcedureexecuteFromState in class StateMachineProcedure<MasterProcedureEnv,MasterProcedureProtos.PeerModificationState>state - state to executeProcedureSuspendedExceptionprotected void rollbackState(MasterProcedureEnv env, MasterProcedureProtos.PeerModificationState state) throws IOException, InterruptedException
StateMachineProcedurerollbackState in class StateMachineProcedure<MasterProcedureEnv,MasterProcedureProtos.PeerModificationState>state - state to rollbackIOException - temporary failure, the rollback will retry laterInterruptedExceptionprotected MasterProcedureProtos.PeerModificationState getState(int stateId)
StateMachineProceduregetState in class StateMachineProcedure<MasterProcedureEnv,MasterProcedureProtos.PeerModificationState>stateId - the ordinal() of the state enum (or state id)protected int getStateId(MasterProcedureProtos.PeerModificationState state)
StateMachineProceduregetStateId in class StateMachineProcedure<MasterProcedureEnv,MasterProcedureProtos.PeerModificationState>state - the state enum objectprotected MasterProcedureProtos.PeerModificationState getInitialState()
StateMachineProceduregetInitialState in class StateMachineProcedure<MasterProcedureEnv,MasterProcedureProtos.PeerModificationState>Copyright © 2007–2019 Cloudera. All rights reserved.