@InterfaceAudience.Private public abstract class ModifyPeerProcedure extends AbstractPeerProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationState>
StateMachineProcedure.FlowProcedure.LockStatePeerProcedureInterface.PeerOperationType| Modifier and Type | Field and Description |
|---|---|
private static org.slf4j.Logger |
LOG |
private RetryCounter |
retryCounter |
protected static int |
SLEEP_INTERVAL_MS |
protected static int |
UPDATE_LAST_SEQ_ID_BATCH_SIZE |
latch, peerIdNO_PROC_ID, NO_TIMEOUT| Modifier | Constructor and Description |
|---|---|
protected |
ModifyPeerProcedure() |
protected |
ModifyPeerProcedure(String peerId) |
| Modifier and Type | Method and Description |
|---|---|
private void |
addToMap(Map<String,Long> lastSeqIds,
String encodedRegionName,
long barrier,
ReplicationQueueStorage queueStorage) |
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,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationState state)
called to perform a single step of the specified 'state' of the procedure
|
protected org.apache.hadoop.hbase.shaded.protobuf.generated.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 org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationState |
getState(int stateId)
Convert an ordinal (or state id) to an Enum (or more descriptive) state object.
|
protected int |
getStateId(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationState state)
Convert the Enum (or more descriptive) state object to an ordinal (or state id).
|
private boolean |
needReopen(TableStateManager tsm,
TableName tn) |
private boolean |
needSetLastPushedSequenceId(TableStateManager tsm,
TableName tn) |
protected org.apache.hadoop.hbase.shaded.protobuf.generated.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.
|
private void |
refreshPeer(MasterProcedureEnv env,
PeerProcedureInterface.PeerOperationType type) |
private void |
releaseLatch() |
protected void |
reopenRegions(MasterProcedureEnv env) |
protected void |
rollbackState(MasterProcedureEnv env,
org.apache.hadoop.hbase.shaded.protobuf.generated.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.
|
private ProcedureSuspendedException |
suspend(org.apache.hadoop.conf.Configuration conf,
LongConsumer backoffConsumer) |
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, 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, waitgetPeerOperationTypeprivate static final org.slf4j.Logger LOG
protected static final int UPDATE_LAST_SEQ_ID_BATCH_SIZE
protected static final int SLEEP_INTERVAL_MS
private RetryCounter retryCounter
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.
IOExceptionReplicationExceptionprivate void releaseLatch()
protected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationState nextStateAfterRefresh()
protected boolean enablePeerBeforeFinish()
private void refreshPeer(MasterProcedureEnv env, PeerProcedureInterface.PeerOperationType type)
protected ReplicationPeerConfig getOldPeerConfig()
protected ReplicationPeerConfig getNewPeerConfig()
protected void updateLastPushedSequenceIdForSerialPeer(MasterProcedureEnv env) throws IOException, ReplicationException
IOExceptionReplicationExceptionprivate boolean needReopen(TableStateManager tsm, TableName tn) throws IOException
IOExceptionprotected void reopenRegions(MasterProcedureEnv env) throws IOException
IOExceptionprotected void enablePeer(MasterProcedureEnv env) throws ReplicationException
ReplicationExceptionprivate void addToMap(Map<String,Long> lastSeqIds, String encodedRegionName, long barrier, ReplicationQueueStorage queueStorage) throws ReplicationException
ReplicationExceptionprotected final void setLastPushedSequenceId(MasterProcedureEnv env, ReplicationPeerConfig peerConfig) throws IOException, ReplicationException
IOExceptionReplicationExceptionprivate boolean needSetLastPushedSequenceId(TableStateManager tsm, TableName tn) throws IOException
IOExceptionprotected 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>private ProcedureSuspendedException suspend(org.apache.hadoop.conf.Configuration conf, LongConsumer backoffConsumer) throws ProcedureSuspendedException
ProcedureSuspendedExceptionprotected StateMachineProcedure.Flow executeFromState(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationState state) throws ProcedureSuspendedException
StateMachineProcedureexecuteFromState in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationState>state - state to executeProcedureSuspendedExceptionprotected void rollbackState(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationState state) throws IOException, InterruptedException
StateMachineProcedurerollbackState in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationState>state - state to rollbackIOException - temporary failure, the rollback will retry laterInterruptedExceptionprotected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationState getState(int stateId)
StateMachineProceduregetState in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationState>stateId - the ordinal() of the state enum (or state id)protected int getStateId(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationState state)
StateMachineProceduregetStateId in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationState>state - the state enum objectprotected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationState getInitialState()
StateMachineProceduregetInitialState in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationState>Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.