Class RefreshPeerProcedure
java.lang.Object
org.apache.hadoop.hbase.procedure2.Procedure<MasterProcedureEnv>
org.apache.hadoop.hbase.master.procedure.ServerRemoteProcedure
org.apache.hadoop.hbase.master.replication.RefreshPeerProcedure
- All Implemented Interfaces:
Comparable<Procedure<MasterProcedureEnv>>
,PeerProcedureInterface
,RemoteProcedureDispatcher.RemoteProcedure<MasterProcedureEnv,
ServerName>
@Private
public class RefreshPeerProcedure
extends ServerRemoteProcedure
implements PeerProcedureInterface, RemoteProcedureDispatcher.RemoteProcedure<MasterProcedureEnv,ServerName>
-
Nested Class Summary
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 TypeFieldDescriptionprivate static final org.slf4j.Logger
private String
private int
Fields inherited from class org.apache.hadoop.hbase.master.procedure.ServerRemoteProcedure
event, remoteError, state, targetServer
Fields inherited from class org.apache.hadoop.hbase.procedure2.Procedure
NO_PROC_ID, NO_TIMEOUT
-
Constructor Summary
ConstructorDescriptionRefreshPeerProcedure
(String peerId, PeerProcedureInterface.PeerOperationType type, ServerName targetServer) RefreshPeerProcedure
(String peerId, PeerProcedureInterface.PeerOperationType type, ServerName targetServer, int stage) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
abort
(MasterProcedureEnv env) The abort() call is asynchronous and each procedure must decide how to deal with it, if they want to be abortable.protected boolean
complete
(MasterProcedureEnv env, Throwable error) protected void
deserializeStateData
(ProcedureStateSerializer serializer) Called on store load to allow the user to decode the previously serialized state.remoteCallBuild
(MasterProcedureEnv env, ServerName remote) For building the remote operation.protected void
The code to undo what was done by the execute() code.protected void
serializeStateData
(ProcedureStateSerializer serializer) The user-level code of the procedure may have some state to persist (e.g.private static org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationType
private static PeerProcedureInterface.PeerOperationType
toPeerOperationType
(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationType type) 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.master.procedure.ServerRemoteProcedure
completionCleanup, execute, remoteCallFailed, remoteOperationCompleted, remoteOperationFailed
Methods inherited from class org.apache.hadoop.hbase.procedure2.Procedure
acquireLock, addStackIndex, afterReplay, beforeReplay, bypass, compareTo, 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, isRollbackSupported, isRunnable, isSuccess, isWaiting, isYieldAfterExecutionStep, releaseLock, removeStackIndex, setAbortFailure, setChildrenLatch, setExecuted, setFailure, setFailure, setLastUpdate, setNonceKey, setOwner, setOwner, setParentProcId, setProcId, setResult, setRootProcId, setStackIndexes, setState, setSubmittedTime, setTimeout, setTimeoutFailure, shouldWaitClientAck, skipPersistence, suspend, toString, toStringClass, toStringClassDetails, toStringDetails, toStringSimpleSB, toStringState, 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.procedure2.RemoteProcedureDispatcher.RemoteProcedure
remoteCallFailed, remoteOperationCompleted, remoteOperationFailed, storeInDispatchedQueue
-
Field Details
-
LOG
-
peerId
-
type
-
stage
-
-
Constructor Details
-
RefreshPeerProcedure
public RefreshPeerProcedure() -
RefreshPeerProcedure
public RefreshPeerProcedure(String peerId, PeerProcedureInterface.PeerOperationType type, ServerName targetServer) -
RefreshPeerProcedure
public RefreshPeerProcedure(String peerId, PeerProcedureInterface.PeerOperationType type, ServerName targetServer, int stage)
-
-
Method Details
-
getPeerId
- Specified by:
getPeerId
in interfacePeerProcedureInterface
-
getPeerOperationType
- Specified by:
getPeerOperationType
in interfacePeerProcedureInterface
-
toPeerModificationType
private static org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationType toPeerModificationType(PeerProcedureInterface.PeerOperationType type) -
toPeerOperationType
private static PeerProcedureInterface.PeerOperationType toPeerOperationType(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.PeerModificationType type) -
remoteCallBuild
public Optional<RemoteProcedureDispatcher.RemoteOperation> remoteCallBuild(MasterProcedureEnv env, ServerName remote) Description copied from interface:RemoteProcedureDispatcher.RemoteProcedure
For building the remote operation. May be empty if no need to send remote call. Usually, this means the RemoteProcedure has been finished already. This is possible, as we may have already sent the procedure to RS but then the rpc connection is broken so the executeProcedures call fails, but the RS does receive the procedure and execute it and then report back, before we retry again.- Specified by:
remoteCallBuild
in interfaceRemoteProcedureDispatcher.RemoteProcedure<MasterProcedureEnv,
ServerName>
-
complete
- Specified by:
complete
in classServerRemoteProcedure
-
rollback
Description copied from class:Procedure
The code to undo what was done by the execute() code. It is called when the procedure or one of the sub-procedures failed or an abort was requested. It should cleanup all the resources created by the execute() call. The implementation must be idempotent since rollback() may be called multiple time in case of machine failure in the middle of the execution.- Specified by:
rollback
in classProcedure<MasterProcedureEnv>
- Parameters:
env
- the environment passed to the ProcedureExecutor- Throws:
IOException
- temporary failure, the rollback will retry laterInterruptedException
- the procedure will be added back to the queue and retried later
-
abort
Description copied from class:Procedure
The abort() call is asynchronous and each procedure must decide how to deal with it, if they want to be abortable. The simplest implementation is to have an AtomicBoolean set in the abort() method and then the execute() will check if the abort flag is set or not. abort() may be called multiple times from the client, so the implementation must be idempotent.NOTE: abort() is not like Thread.interrupt(). It is just a notification that allows the procedure implementor abort.
- Specified by:
abort
in classProcedure<MasterProcedureEnv>
-
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.
-
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.- Specified by:
serializeStateData
in classProcedure<MasterProcedureEnv>
- 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.- Specified by:
deserializeStateData
in classProcedure<MasterProcedureEnv>
- Parameters:
serializer
- contains the serialized state- Throws:
IOException
-