@InterfaceAudience.Private public abstract class AbstractPeerProcedure<TState> extends AbstractPeerNoLockProcedure<TState> implements PeerProcedureInterface
StateMachineProcedure.Flow
Procedure.LockState
PeerProcedureInterface.PeerOperationType
Modifier and Type | Field and Description |
---|---|
protected ProcedurePrepareLatch |
latch |
private static org.slf4j.Logger |
LOG |
protected static int |
SLEEP_INTERVAL_MS |
protected static int |
UPDATE_LAST_SEQ_ID_BATCH_SIZE |
peerId
stateCount
NO_PROC_ID, NO_TIMEOUT
Modifier | Constructor and Description |
---|---|
protected |
AbstractPeerProcedure() |
protected |
AbstractPeerProcedure(String peerId) |
Modifier and Type | Method and Description |
---|---|
protected Procedure.LockState |
acquireLock(MasterProcedureEnv env)
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 void |
checkPeerModificationEnabled(MasterProcedureEnv env) |
protected void |
enablePeer(MasterProcedureEnv env) |
ProcedurePrepareLatch |
getLatch() |
protected boolean |
holdLock(MasterProcedureEnv env)
Used to keep the procedure lock even when the procedure is yielding or suspended.
|
private boolean |
needSetLastPushedSequenceId(TableStateManager tsm,
TableName tn) |
protected void |
refreshPeer(MasterProcedureEnv env,
PeerProcedureInterface.PeerOperationType type) |
protected void |
releaseLock(MasterProcedureEnv env)
The user should override this method, and release lock if necessary.
|
protected void |
setLastPushedSequenceId(MasterProcedureEnv env,
ReplicationPeerConfig peerConfig) |
protected void |
setLastPushedSequenceIdForTable(MasterProcedureEnv env,
TableName tableName,
Map<String,Long> lastSeqIds) |
deserializeStateData, getPeerId, resetRetry, rollbackState, serializeStateData, setTimeoutFailure, suspend, waitInitialized
abort, addChildProcedure, execute, executeFromState, failIfAborted, getCurrentState, getCurrentStateId, getCycles, getInitialState, getState, getStateId, isEofState, isRollbackSupported, isRollbackSupported, isYieldAfterExecutionStep, isYieldBeforeExecuteFromState, rollback, setNextState, toStringState
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getPeerId, getPeerOperationType
private static final org.slf4j.Logger LOG
protected static final int UPDATE_LAST_SEQ_ID_BATCH_SIZE
protected static final int SLEEP_INTERVAL_MS
protected ProcedurePrepareLatch latch
protected AbstractPeerProcedure()
protected AbstractPeerProcedure(String peerId)
public ProcedurePrepareLatch getLatch()
protected Procedure.LockState acquireLock(MasterProcedureEnv env)
Procedure
Procedure.execute(Object)
. It calls Procedure.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, see Procedure.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:
acquireLock
in class Procedure<MasterProcedureEnv>
protected void releaseLock(MasterProcedureEnv env)
Procedure
releaseLock
in class Procedure<MasterProcedureEnv>
protected boolean holdLock(MasterProcedureEnv env)
Procedure
holdLock
in class Procedure<MasterProcedureEnv>
protected final void refreshPeer(MasterProcedureEnv env, PeerProcedureInterface.PeerOperationType type)
protected void enablePeer(MasterProcedureEnv env) throws ReplicationException
ReplicationException
private void addToMap(Map<String,Long> lastSeqIds, String encodedRegionName, long barrier, ReplicationQueueStorage queueStorage) throws ReplicationException
ReplicationException
protected final void setLastPushedSequenceId(MasterProcedureEnv env, ReplicationPeerConfig peerConfig) throws IOException, ReplicationException
IOException
ReplicationException
private boolean needSetLastPushedSequenceId(TableStateManager tsm, TableName tn) throws IOException
IOException
protected final void setLastPushedSequenceIdForTable(MasterProcedureEnv env, TableName tableName, Map<String,Long> lastSeqIds) throws IOException, ReplicationException
IOException
ReplicationException
protected final void checkPeerModificationEnabled(MasterProcedureEnv env) throws IOException
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.