Class AbstractPeerProcedure<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>
org.apache.hadoop.hbase.master.replication.AbstractPeerProcedure<TState>
- All Implemented Interfaces:
Comparable<Procedure<MasterProcedureEnv>>,PeerProcedureInterface
- Direct Known Subclasses:
ModifyPeerProcedure,TransitPeerSyncReplicationStateProcedure
@Private
public abstract class AbstractPeerProcedure<TState>
extends AbstractPeerNoLockProcedure<TState>
implements PeerProcedureInterface
The base class for all replication peer related procedure.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.procedure2.StateMachineProcedure
StateMachineProcedure.FlowNested classes/interfaces inherited from class org.apache.hadoop.hbase.procedure2.Procedure
Procedure.LockStateNested classes/interfaces inherited from interface org.apache.hadoop.hbase.master.procedure.PeerProcedureInterface
PeerProcedureInterface.PeerOperationType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ProcedurePrepareLatchprivate static final org.slf4j.Loggerprotected static final intprotected static final intFields inherited from class org.apache.hadoop.hbase.master.replication.AbstractPeerNoLockProcedure
peerIdFields inherited from class org.apache.hadoop.hbase.procedure2.StateMachineProcedure
stateCountFields inherited from class org.apache.hadoop.hbase.procedure2.Procedure
NO_PROC_ID, NO_TIMEOUT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Procedure.LockStateThe user should override this method if they need a lock on an Entity.private voidaddToMap(Map<String, Long> lastSeqIds, String encodedRegionName, long barrier, ReplicationQueueStorage queueStorage) protected final voidprotected voidgetLatch()protected booleanUsed to keep the procedure lock even when the procedure is yielding or suspended.private booleanprotected final voidprotected voidThe user should override this method, and release lock if necessary.protected final voidsetLastPushedSequenceId(MasterProcedureEnv env, ReplicationPeerConfig peerConfig) protected final voidsetLastPushedSequenceIdForTable(MasterProcedureEnv env, TableName tableName, Map<String, Long> lastSeqIds) Methods inherited from class org.apache.hadoop.hbase.master.replication.AbstractPeerNoLockProcedure
deserializeStateData, getPeerId, resetRetry, rollbackState, serializeStateData, setTimeoutFailure, suspend, waitInitializedMethods 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, toStringStateMethods inherited from class org.apache.hadoop.hbase.procedure2.Procedure
addStackIndex, afterExec, afterReplay, beforeExec, 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, 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, wasExecutedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.master.procedure.PeerProcedureInterface
getPeerId, getPeerOperationType
-
Field Details
-
LOG
-
UPDATE_LAST_SEQ_ID_BATCH_SIZE
- See Also:
-
SLEEP_INTERVAL_MS
- See Also:
-
latch
-
-
Constructor Details
-
AbstractPeerProcedure
protected AbstractPeerProcedure() -
AbstractPeerProcedure
-
-
Method Details
-
getLatch
-
acquireLock
Description copied from class:ProcedureThe user should override this method if they need a lock on an Entity. A lock can be anything, and it is up to the implementor. The Procedure Framework will call this method just before it invokesProcedure.execute(Object). It callsProcedure.releaseLock(Object)after the call to execute. If you need to hold the lock for the life of the Procedure -- i.e. you do not want any other Procedure interfering while this Procedure is running, seeProcedure.holdLock(Object). Example: in our Master we can execute request in parallel for different tables. We can create t1 and create t2 and these creates can be executed at the same time. Anything else on t1/t2 is queued waiting that specific table create to happen. There are 3 LockState:- LOCK_ACQUIRED should be returned when the proc has the lock and the proc is ready to execute.
- LOCK_YIELD_WAIT should be returned when the proc has not the lock and the framework should take care of readding the procedure back to the runnable set for retry
- LOCK_EVENT_WAIT should be returned when the proc has not the lock and someone will take care of readding the procedure back to the runnable set when the lock is available.
- Overrides:
acquireLockin classProcedure<MasterProcedureEnv>- Returns:
- the lock state as described above.
-
releaseLock
Description copied from class:ProcedureThe user should override this method, and release lock if necessary.- Overrides:
releaseLockin classProcedure<MasterProcedureEnv>
-
holdLock
Description copied from class:ProcedureUsed to keep the procedure lock even when the procedure is yielding or suspended.- Overrides:
holdLockin classProcedure<MasterProcedureEnv>- Returns:
- true if the procedure should hold on the lock until completionCleanup()
-
refreshPeer
protected final void refreshPeer(MasterProcedureEnv env, PeerProcedureInterface.PeerOperationType type) -
enablePeer
- Throws:
ReplicationException
-
addToMap
private void addToMap(Map<String, Long> lastSeqIds, String encodedRegionName, long barrier, ReplicationQueueStorage queueStorage) throws ReplicationException- Throws:
ReplicationException
-
setLastPushedSequenceId
protected final void setLastPushedSequenceId(MasterProcedureEnv env, ReplicationPeerConfig peerConfig) throws IOException, ReplicationException - Throws:
IOExceptionReplicationException
-
needSetLastPushedSequenceId
- Throws:
IOException
-
setLastPushedSequenceIdForTable
protected final void setLastPushedSequenceIdForTable(MasterProcedureEnv env, TableName tableName, Map<String, Long> lastSeqIds) throws IOException, ReplicationException- Throws:
IOExceptionReplicationException
-
checkPeerModificationEnabled
- Throws:
IOException
-