Class AbstractPeerNoLockProcedure<TState>
java.lang.Object
org.apache.hadoop.hbase.procedure2.Procedure<TEnvironment>
org.apache.hadoop.hbase.procedure2.StateMachineProcedure<MasterProcedureEnv,TState>
org.apache.hadoop.hbase.master.replication.AbstractPeerNoLockProcedure<TState>
- All Implemented Interfaces:
Comparable<Procedure<MasterProcedureEnv>>
,PeerProcedureInterface
- Direct Known Subclasses:
AbstractPeerProcedure
,RecoverStandbyProcedure
,SyncReplicationReplayWALProcedure
@Private
public abstract class AbstractPeerNoLockProcedure<TState>
extends StateMachineProcedure<MasterProcedureEnv,TState>
implements PeerProcedureInterface
Base class for replication peer related procedures which do not need to hold locks(for most of
the sub procedures).
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.procedure2.StateMachineProcedure
StateMachineProcedure.Flow
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.procedure2.Procedure
Procedure.LockState
Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.master.procedure.PeerProcedureInterface
PeerProcedureInterface.PeerOperationType
-
Field Summary
Fields inherited from class org.apache.hadoop.hbase.procedure2.StateMachineProcedure
stateCount
Fields inherited from class org.apache.hadoop.hbase.procedure2.Procedure
NO_PROC_ID, NO_TIMEOUT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
deserializeStateData
(ProcedureStateSerializer serializer) Called on store load to allow the user to decode the previously serialized state.protected final void
protected void
rollbackState
(MasterProcedureEnv env, TState state) called to perform the rollback of the specified stateprotected void
serializeStateData
(ProcedureStateSerializer serializer) The user-level code of the procedure may have some state to persist (e.g.protected boolean
Called by the ProcedureExecutor when the timeout set by setTimeout() is expired.protected final ProcedureSuspendedException
suspend
(org.apache.hadoop.conf.Configuration conf, LongConsumer backoffConsumer) protected boolean
TheProcedure.doAcquireLock(Object, ProcedureStore)
will be split into two steps, first, it will call us to determine whether we need to wait for initialization, second, it will callProcedure.acquireLock(Object)
to actually handle the lock for this procedure.Methods inherited from class org.apache.hadoop.hbase.procedure2.StateMachineProcedure
abort, addChildProcedure, execute, executeFromState, failIfAborted, getCurrentState, getCurrentStateId, getCycles, getInitialState, getState, getStateId, isEofState, isRollbackSupported, isRollbackSupported, isYieldAfterExecutionStep, isYieldBeforeExecuteFromState, rollback, setNextState, toStringState
Methods inherited from class org.apache.hadoop.hbase.procedure2.Procedure
acquireLock, addStackIndex, 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, holdLock, incChildrenLatch, isBypass, isFailed, isFinished, isInitializing, isLockedWhenLoading, isRunnable, isSuccess, isWaiting, releaseLock, removeStackIndex, setAbortFailure, setChildrenLatch, setExecuted, setFailure, setFailure, setLastUpdate, setNonceKey, setOwner, setOwner, setParentProcId, setProcId, setResult, setRootProcId, setStackIndexes, setState, setSubmittedTime, setTimeout, shouldWaitClientAck, skipPersistence, suspend, toString, toStringClass, toStringClassDetails, toStringDetails, toStringSimpleSB, updateMetricsOnFinish, updateMetricsOnSubmit, updateTimestamp, wasExecuted
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.hadoop.hbase.master.procedure.PeerProcedureInterface
getPeerOperationType
-
Field Details
-
peerId
-
retryCounter
-
-
Constructor Details
-
AbstractPeerNoLockProcedure
protected AbstractPeerNoLockProcedure() -
AbstractPeerNoLockProcedure
-
-
Method Details
-
getPeerId
- Specified by:
getPeerId
in interfacePeerProcedureInterface
-
waitInitialized
Description copied from class:Procedure
TheProcedure.doAcquireLock(Object, ProcedureStore)
will be split into two steps, first, it will call us to determine whether we need to wait for initialization, second, it will callProcedure.acquireLock(Object)
to actually handle the lock for this procedure. This is because that when master restarts, we need to restore the lock state for all the procedures to not break the semantic ifProcedure.holdLock(Object)
is true. But theProcedureExecutor
will be started before the master finish initialization(as it is part of the initialization!), so we need to split the code into two steps, and when restore, we just restore the lock part and ignore the waitInitialized part. Otherwise there will be dead lock.- Overrides:
waitInitialized
in classProcedure<MasterProcedureEnv>
- Returns:
- true means we need to wait until the environment has been initialized, otherwise true.
-
rollbackState
protected void rollbackState(MasterProcedureEnv env, TState state) throws IOException, InterruptedException Description copied from class:StateMachineProcedure
called to perform the rollback of the specified state- Specified by:
rollbackState
in classStateMachineProcedure<MasterProcedureEnv,
TState> state
- state to rollback- Throws:
IOException
- temporary failure, the rollback will retry laterInterruptedException
-
serializeStateData
Description copied from class:Procedure
The user-level code of the procedure may have some state to persist (e.g. input arguments or current position in the processing state) to be able to resume on failure.- Overrides:
serializeStateData
in classStateMachineProcedure<MasterProcedureEnv,
TState> - Parameters:
serializer
- stores the serializable state- Throws:
IOException
-
deserializeStateData
Description copied from class:Procedure
Called on store load to allow the user to decode the previously serialized state.- Overrides:
deserializeStateData
in classStateMachineProcedure<MasterProcedureEnv,
TState> - Parameters:
serializer
- contains the serialized state- Throws:
IOException
-
setTimeoutFailure
Description copied from class:Procedure
Called by the ProcedureExecutor when the timeout set by setTimeout() is expired. Another usage for this method is to implement retrying. A procedure can set the state toWAITING_TIMEOUT
by callingsetState
method, and throw aProcedureSuspendedException
to halt the execution of the procedure, and do not forget a callProcedure.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.- Overrides:
setTimeoutFailure
in classProcedure<MasterProcedureEnv>
- Returns:
- true to let the framework handle the timeout as abort, false in case the procedure handled the timeout itself.
-
suspend
protected final ProcedureSuspendedException suspend(org.apache.hadoop.conf.Configuration conf, LongConsumer backoffConsumer) throws ProcedureSuspendedException - Throws:
ProcedureSuspendedException
-
resetRetry
-