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.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
Modifier and TypeFieldDescriptionprotected ProcedurePrepareLatch
private static final org.slf4j.Logger
protected static final int
protected static final int
Fields inherited from class org.apache.hadoop.hbase.master.replication.AbstractPeerNoLockProcedure
peerId
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 Procedure.LockState
The user should override this method if they need a lock on an Entity.private void
addToMap
(Map<String, Long> lastSeqIds, String encodedRegionName, long barrier, ReplicationQueueStorage queueStorage) protected final void
protected void
getLatch()
protected boolean
Used to keep the procedure lock even when the procedure is yielding or suspended.private boolean
protected final void
protected void
The user should override this method, and release lock if necessary.protected final void
setLastPushedSequenceId
(MasterProcedureEnv env, ReplicationPeerConfig peerConfig) protected final void
setLastPushedSequenceIdForTable
(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, waitInitialized
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
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, 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, 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
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:Procedure
The 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:
acquireLock
in classProcedure<MasterProcedureEnv>
- Returns:
- the lock state as described above.
-
releaseLock
Description copied from class:Procedure
The user should override this method, and release lock if necessary.- Overrides:
releaseLock
in classProcedure<MasterProcedureEnv>
-
holdLock
Description copied from class:Procedure
Used to keep the procedure lock even when the procedure is yielding or suspended.- Overrides:
holdLock
in 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:
IOException
ReplicationException
-
needSetLastPushedSequenceId
- Throws:
IOException
-
setLastPushedSequenceIdForTable
protected final void setLastPushedSequenceIdForTable(MasterProcedureEnv env, TableName tableName, Map<String, Long> lastSeqIds) throws IOException, ReplicationException- Throws:
IOException
ReplicationException
-
checkPeerModificationEnabled
- Throws:
IOException
-