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.Flow
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.TableProcedureInterface
TableProcedureInterface.TableOperationType
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
private RetryCounter
protected TableName
Fields inherited from class org.apache.hadoop.hbase.procedure2.StateMachineProcedure
stateCount
Fields inherited from class org.apache.hadoop.hbase.procedure2.Procedure
NO_PROC_ID, NO_TIMEOUT
Fields inherited from interface org.apache.hadoop.hbase.master.procedure.TableProcedureInterface
DUMMY_NAMESPACE_TABLE_NAME
-
Constructor Summary
ModifierConstructorDescriptionprotected
protected
AbstractCloseTableRegionsProcedure
(TableName tableName) -
Method Summary
Modifier and TypeMethodDescriptionprivate StateMachineProcedure.Flow
protected StateMachineProcedure.Flow
executeFromState
(MasterProcedureEnv env, TState state) called to perform a single step of the specified 'state' of the procedureprotected abstract TState
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 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 int
Return the number of uncloses regions.protected void
rollbackState
(MasterProcedureEnv env, TState state) called to perform the rollback of the specified stateprivate StateMachineProcedure.Flow
protected boolean
Called by the ProcedureExecutor when the timeout set by setTimeout() is expired.protected abstract int
Submit TRSP for unassigning regions.Methods inherited from class org.apache.hadoop.hbase.master.procedure.AbstractStateMachineTableProcedure
acquireLock, checkOnline, checkTableModifiable, getUser, getWALRegionDir, isTableEnabled, preflightChecks, releaseLock, releaseSyncLatch, setUser, toStringClassDetails, waitInitialized
Methods 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, toStringState
Methods 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, 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:TableProcedureInterface
Returns the name of the table the procedure is operating on- Specified by:
getTableName
in interfaceTableProcedureInterface
- Specified by:
getTableName
in classAbstractStateMachineTableProcedure<TState extends Enum<?>>
-
getTableOperationType
Description copied from interface:TableProcedureInterface
Given 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:
getTableOperationType
in interfaceTableProcedureInterface
- Specified by:
getTableOperationType
in 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:StateMachineProcedure
called to perform a single step of the specified 'state' of the procedure- Specified by:
executeFromState
in 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:
ProcedureSuspendedException
ProcedureYieldException
InterruptedException
-
rollbackState
protected void rollbackState(MasterProcedureEnv env, TState state) throws IOException, InterruptedException Description copied from class:StateMachineProcedure
called to perform the rollback of the specified state- Specified by:
rollbackState
in classStateMachineProcedure<MasterProcedureEnv,
TState extends Enum<?>> state
- state to rollback- Throws:
IOException
- temporary failure, the rollback will retry laterInterruptedException
-
setTimeoutFailure
Description copied from class:Procedure
Called 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_TIMEOUT
by callingsetState
method, and throw aProcedureSuspendedException
to 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:
setTimeoutFailure
in 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. Returning0
means we are done.
-