Class AbstractCloseTableRegionsProcedure<TState extends Enum<?>>
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.AbstractCloseTableRegionsProcedure<TState>
- All Implemented Interfaces:
Comparable<Procedure<MasterProcedureEnv>>,TableProcedureInterface
- Direct Known Subclasses:
CloseExcessRegionReplicasProcedure,CloseTableRegionsProcedure
@Private
public abstract class AbstractCloseTableRegionsProcedure<TState extends Enum<?>>
extends AbstractStateMachineTableProcedure<TState>
Base class for unassigning table regions.
-
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
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate RetryCounterprotected TableNameFields inherited from class org.apache.hadoop.hbase.procedure2.StateMachineProcedure
stateCountFields inherited from class org.apache.hadoop.hbase.procedure2.Procedure
NO_PROC_ID, NO_TIMEOUTFields inherited from interface org.apache.hadoop.hbase.master.procedure.TableProcedureInterface
DUMMY_NAMESPACE_TABLE_NAME -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedAbstractCloseTableRegionsProcedure(TableName tableName) -
Method Summary
Modifier and TypeMethodDescriptionprivate StateMachineProcedure.Flowprotected StateMachineProcedure.FlowexecuteFromState(MasterProcedureEnv env, TState state) called to perform a single step of the specified 'state' of the procedureprotected abstract TStateWe have two state for this type of procedures, the initial state for scheduling unassign procedures, and the confirm state for checking whether we have unassigned all the regions.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 abstract intReturn the number of uncloses regions.protected voidrollbackState(MasterProcedureEnv env, TState state) called to perform the rollback of the specified stateprivate StateMachineProcedure.Flowprotected booleanCalled by the ProcedureExecutor when the timeout set by setTimeout() is expired.protected abstract intSubmit TRSP for unassigning regions.Methods inherited from class org.apache.hadoop.hbase.master.procedure.AbstractStateMachineTableProcedure
acquireLock, checkOnline, checkTableModifiable, getUser, getWALRegionDir, isTableEnabled, isTableModificationInProgress, preflightChecks, releaseLock, releaseSyncLatch, setUser, toStringClassDetails, waitInitializedMethods inherited from class org.apache.hadoop.hbase.procedure2.StateMachineProcedure
abort, addChildProcedure, deserializeStateData, execute, failIfAborted, getCurrentState, getCurrentStateId, getCycles, getInitialState, getState, getStateId, isEofState, isRollbackSupported, isRollbackSupported, isYieldAfterExecutionStep, isYieldBeforeExecuteFromState, rollback, serializeStateData, setNextState, toStringStateMethods inherited from class org.apache.hadoop.hbase.procedure2.Procedure
addStackIndex, afterExec, afterReplay, beforeExec, 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, holdLock, 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, toStringDetails, toStringSimpleSB, updateMetricsOnFinish, updateMetricsOnSubmit, updateTimestamp, wasExecuted
-
Field Details
-
LOG
-
tableName
-
retryCounter
-
-
Constructor Details
-
AbstractCloseTableRegionsProcedure
protected AbstractCloseTableRegionsProcedure() -
AbstractCloseTableRegionsProcedure
-
-
Method Details
-
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 extends Enum<?>>
-
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 extends Enum<?>>- Returns:
- the operation type that the procedure is executing.
-
schedule
private StateMachineProcedure.Flow schedule(MasterProcedureEnv env) throws ProcedureSuspendedException - Throws:
ProcedureSuspendedException
-
confirm
-
executeFromState
protected StateMachineProcedure.Flow executeFromState(MasterProcedureEnv env, TState state) throws ProcedureSuspendedException, ProcedureYieldException, InterruptedException Description copied from class:StateMachineProcedurecalled to perform a single step of the specified 'state' of the procedure- Specified by:
executeFromStatein classStateMachineProcedure<MasterProcedureEnv,TState extends Enum<?>> state- state to execute- Returns:
- Flow.NO_MORE_STATE if the procedure is completed, Flow.HAS_MORE_STATE if there is another step.
- Throws:
ProcedureSuspendedExceptionProcedureYieldExceptionInterruptedException
-
rollbackState
protected void rollbackState(MasterProcedureEnv env, TState state) throws IOException, InterruptedException Description copied from class:StateMachineProcedurecalled to perform the rollback of the specified state- Specified by:
rollbackStatein classStateMachineProcedure<MasterProcedureEnv,TState extends Enum<?>> state- state to rollback- Throws:
IOException- temporary failure, the rollback will retry laterInterruptedException
-
setTimeoutFailure
Description copied from class:ProcedureCalled by the ProcedureExecutor when the timeout set by setTimeout() is expired. Another usage for this method is to implement retrying. A procedure can set the state toWAITING_TIMEOUTby callingsetStatemethod, and throw aProcedureSuspendedExceptionto halt the execution of the procedure, and do not forget a callProcedure.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.- Overrides:
setTimeoutFailurein classProcedure<MasterProcedureEnv>- Returns:
- true to let the framework handle the timeout as abort, false in case the procedure handled the timeout itself.
-
getConfirmState
We have two state for this type of procedures, the initial state for scheduling unassign procedures, and the confirm state for checking whether we have unassigned all the regions.- Returns:
- the confirm state
-
submitUnassignProcedure
protected abstract int submitUnassignProcedure(MasterProcedureEnv env, Consumer<TransitRegionStateProcedure> submit) Submit TRSP for unassigning regions. Return the number of regions in RIT state that we can not schedule TRSP for them. -
numberOfUnclosedRegions
Return the number of uncloses regions. Returning0means we are done.
-