Class AbstractStateMachineRegionProcedure<TState>
java.lang.Object
org.apache.hadoop.hbase.procedure2.Procedure<TEnvironment>
org.apache.hadoop.hbase.procedure2.StateMachineProcedure<MasterProcedureEnv,TState>
org.apache.hadoop.hbase.master.procedure.AbstractStateMachineTableProcedure<TState>
org.apache.hadoop.hbase.master.procedure.AbstractStateMachineRegionProcedure<TState>
- All Implemented Interfaces:
Comparable<Procedure<MasterProcedureEnv>>,TableProcedureInterface
- Direct Known Subclasses:
GCRegionProcedure,MoveRegionProcedure,SplitTableRegionProcedure,TransitRegionStateProcedure,TruncateRegionProcedure
@Private
public abstract class AbstractStateMachineRegionProcedure<TState>
extends AbstractStateMachineTableProcedure<TState>
Base class for all the Region procedures that want to use a StateMachine. It provides some basic
helpers like basic locking, sync latch, and toStringClassDetails(). Defaults to holding the lock
for the life of the 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.TableProcedureInterface
TableProcedureInterface.TableOperationType -
Field Summary
FieldsFields 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
ConstructorsModifierConstructorDescriptionprotectedprotectedprotectedAbstractStateMachineRegionProcedure(MasterProcedureEnv env, RegionInfo hri, ProcedurePrepareLatch latch) -
Method Summary
Modifier and TypeMethodDescriptionprotected Procedure.LockStateThe user should override this method if they need a lock on an Entity.protected voiddeserializeStateData(ProcedureStateSerializer serializer) Called on store load to allow the user to decode the previously serialized state.Returns The RegionInfo of the region we are operating on.Returns the name of the table the procedure is operating onGiven an operation type we can take decisions about what to do with pending operations.protected booleanUsed to keep the procedure lock even when the procedure is yielding or suspended.protected voidThe user should override this method, and release lock if necessary.protected voidserializeStateData(ProcedureStateSerializer serializer) The user-level code of the procedure may have some state to persist (e.g.protected voidsetFailure(Throwable cause) protected voidsetRegion(RegionInfo hri) Used when deserializing.voidExtend the toString() information with the procedure details e.g.Methods inherited from class org.apache.hadoop.hbase.master.procedure.AbstractStateMachineTableProcedure
checkOnline, checkTableModifiable, getUser, getWALRegionDir, isTableEnabled, preflightChecks, releaseSyncLatch, setUser, 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, rollbackState, setNextState, toStringStateMethods 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, setTimeoutFailure, shouldWaitClientAck, skipPersistence, suspend, toString, toStringClass, toStringDetails, toStringSimpleSB, updateMetricsOnFinish, updateMetricsOnSubmit, updateTimestamp, wasExecuted
-
Field Details
-
hri
-
-
Constructor Details
-
AbstractStateMachineRegionProcedure
-
AbstractStateMachineRegionProcedure
protected AbstractStateMachineRegionProcedure(MasterProcedureEnv env, RegionInfo hri, ProcedurePrepareLatch latch) -
AbstractStateMachineRegionProcedure
protected AbstractStateMachineRegionProcedure()
-
-
Method Details
-
getRegion
Returns The RegionInfo of the region we are operating on. -
setRegion
Used when deserializing. Otherwise, DON'T TOUCH IT! -
getTableName
Description copied from interface:TableProcedureInterfaceReturns the name of the table the procedure is operating on- Specified by:
getTableNamein interfaceTableProcedureInterface- Specified by:
getTableNamein classAbstractStateMachineTableProcedure<TState>
-
getTableOperationType
Description copied from interface:TableProcedureInterfaceGiven an operation type we can take decisions about what to do with pending operations. e.g. if we get a delete and we have some table operation pending (e.g. add column) we can abort those operations.- Specified by:
getTableOperationTypein interfaceTableProcedureInterface- Specified by:
getTableOperationTypein classAbstractStateMachineTableProcedure<TState>- Returns:
- the operation type that the procedure is executing.
-
toStringClassDetails
Description copied from class:ProcedureExtend the toString() information with the procedure details e.g. className and parameters- Overrides:
toStringClassDetailsin classAbstractStateMachineTableProcedure<TState>- Parameters:
sb- the string builder to use to append the proc specific information
-
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()
-
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 classAbstractStateMachineTableProcedure<TState>- 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 classAbstractStateMachineTableProcedure<TState>
-
setFailure
-
serializeStateData
Description copied from class:ProcedureThe 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.- Overrides:
serializeStateDatain classStateMachineProcedure<MasterProcedureEnv,TState> - Parameters:
serializer- stores the serializable state- Throws:
IOException
-
deserializeStateData
Description copied from class:ProcedureCalled on store load to allow the user to decode the previously serialized state.- Overrides:
deserializeStateDatain classStateMachineProcedure<MasterProcedureEnv,TState> - Parameters:
serializer- contains the serialized state- Throws:
IOException
-