@InterfaceAudience.Private public class SplitTableRegionProcedure extends AbstractStateMachineRegionProcedure<MasterProcedureProtos.SplitTableRegionState>
Throws exception on construction if determines context hostile to spllt (cluster going down or master is shutting down or table is disabled).
StateMachineProcedure.Flow
Procedure.LockState
TableProcedureInterface.TableOperationType
stateCount
NO_PROC_ID, NO_TIMEOUT
Constructor and Description |
---|
SplitTableRegionProcedure() |
SplitTableRegionProcedure(MasterProcedureEnv env,
RegionInfo regionToSplit,
byte[] splitRow) |
Modifier and Type | Method and Description |
---|---|
protected 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.
|
void |
createDaughterRegions(MasterProcedureEnv env)
Create daughter regions
|
protected void |
deserializeStateData(ProcedureStateSerializer serializer)
Called on store load to allow the user to decode the previously serialized
state.
|
protected StateMachineProcedure.Flow |
executeFromState(MasterProcedureEnv env,
MasterProcedureProtos.SplitTableRegionState state)
called to perform a single step of the specified 'state' of the procedure
|
protected MasterProcedureProtos.SplitTableRegionState |
getInitialState()
Return the initial state object that will be used for the first call to executeFromState().
|
protected ProcedureMetrics |
getProcedureMetrics(MasterProcedureEnv env)
Override this method to provide procedure specific counters for submitted count, failed
count and time histogram.
|
protected MasterProcedureProtos.SplitTableRegionState |
getState(int stateId)
Convert an ordinal (or state id) to an Enum (or more descriptive) state object.
|
protected int |
getStateId(MasterProcedureProtos.SplitTableRegionState state)
Convert the Enum (or more descriptive) state object to an ordinal (or state id).
|
TableProcedureInterface.TableOperationType |
getTableOperationType()
Given an operation type we can take decisions about what to do with pending operations.
|
protected boolean |
isRollbackSupported(MasterProcedureProtos.SplitTableRegionState state)
Used by the default implementation of abort() to know if the current state can be aborted
and rollback can be triggered.
|
boolean |
prepareSplitRegion(MasterProcedureEnv env)
Prepare to Split region.
|
protected void |
rollbackState(MasterProcedureEnv env,
MasterProcedureProtos.SplitTableRegionState state)
To rollback
SplitTableRegionProcedure , an AssignProcedure is asynchronously
submitted for parent region to be split (rollback doesn't wait on the completion of the
AssignProcedure) . |
protected void |
serializeStateData(ProcedureStateSerializer serializer)
The user-level code of the procedure may have some state to
persist (e.g.
|
void |
toStringClassDetails(StringBuilder sb)
Extend the toString() information with the procedure details
e.g.
|
acquireLock, checkTableModifiable, getRegion, getTableName, holdLock, releaseLock, setFailure, setRegion
checkOnline, getUser, getWALRegionDir, preflightChecks, releaseSyncLatch, setUser, waitInitialized
addChildProcedure, execute, failIfAborted, getCurrentState, getCurrentStateId, getCycles, isEofState, isYieldAfterExecutionStep, isYieldBeforeExecuteFromState, rollback, setNextState, toStringState
addStackIndex, afterReplay, beforeReplay, bypass, compareTo, completionCleanup, doExecute, doRollback, elapsedTime, getChildrenLatch, getException, getLastUpdate, getNonceKey, getOwner, getParentProcId, 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, setTimeoutFailure, shouldWaitClientAck, skipPersistence, toString, toStringClass, toStringDetails, toStringSimpleSB, updateMetricsOnFinish, updateMetricsOnSubmit, updateTimestamp, wasExecuted
public SplitTableRegionProcedure()
public SplitTableRegionProcedure(MasterProcedureEnv env, RegionInfo regionToSplit, byte[] splitRow) throws IOException
IOException
protected StateMachineProcedure.Flow executeFromState(MasterProcedureEnv env, MasterProcedureProtos.SplitTableRegionState state) throws InterruptedException
StateMachineProcedure
executeFromState
in class StateMachineProcedure<MasterProcedureEnv,MasterProcedureProtos.SplitTableRegionState>
state
- state to executeInterruptedException
protected void rollbackState(MasterProcedureEnv env, MasterProcedureProtos.SplitTableRegionState state) throws IOException, InterruptedException
SplitTableRegionProcedure
, an AssignProcedure is asynchronously
submitted for parent region to be split (rollback doesn't wait on the completion of the
AssignProcedure) . This can be improved by changing rollback() to support sub-procedures.
See HBASE-19851 for details.rollbackState
in class StateMachineProcedure<MasterProcedureEnv,MasterProcedureProtos.SplitTableRegionState>
state
- state to rollbackIOException
- temporary failure, the rollback will retry laterInterruptedException
protected boolean isRollbackSupported(MasterProcedureProtos.SplitTableRegionState state)
StateMachineProcedure
protected MasterProcedureProtos.SplitTableRegionState getState(int stateId)
StateMachineProcedure
getState
in class StateMachineProcedure<MasterProcedureEnv,MasterProcedureProtos.SplitTableRegionState>
stateId
- the ordinal() of the state enum (or state id)protected int getStateId(MasterProcedureProtos.SplitTableRegionState state)
StateMachineProcedure
getStateId
in class StateMachineProcedure<MasterProcedureEnv,MasterProcedureProtos.SplitTableRegionState>
state
- the state enum objectprotected MasterProcedureProtos.SplitTableRegionState getInitialState()
StateMachineProcedure
getInitialState
in class StateMachineProcedure<MasterProcedureEnv,MasterProcedureProtos.SplitTableRegionState>
protected void serializeStateData(ProcedureStateSerializer serializer) throws IOException
Procedure
serializeStateData
in class AbstractStateMachineRegionProcedure<MasterProcedureProtos.SplitTableRegionState>
serializer
- stores the serializable stateIOException
protected void deserializeStateData(ProcedureStateSerializer serializer) throws IOException
Procedure
deserializeStateData
in class AbstractStateMachineRegionProcedure<MasterProcedureProtos.SplitTableRegionState>
serializer
- contains the serialized stateIOException
public void toStringClassDetails(StringBuilder sb)
Procedure
toStringClassDetails
in class AbstractStateMachineRegionProcedure<MasterProcedureProtos.SplitTableRegionState>
sb
- the string builder to use to append the proc specific informationpublic TableProcedureInterface.TableOperationType getTableOperationType()
TableProcedureInterface
getTableOperationType
in interface TableProcedureInterface
getTableOperationType
in class AbstractStateMachineRegionProcedure<MasterProcedureProtos.SplitTableRegionState>
protected ProcedureMetrics getProcedureMetrics(MasterProcedureEnv env)
Procedure
getProcedureMetrics
in class Procedure<MasterProcedureEnv>
env
- The environment passed to the procedure executorpublic boolean prepareSplitRegion(MasterProcedureEnv env) throws IOException
env
- MasterProcedureEnvIOException
public void createDaughterRegions(MasterProcedureEnv env) throws IOException
env
- MasterProcedureEnvIOException
protected boolean abort(MasterProcedureEnv env)
Procedure
NOTE: abort() is not like Thread.interrupt(). It is just a notification that allows the procedure implementor abort.
abort
in class StateMachineProcedure<MasterProcedureEnv,MasterProcedureProtos.SplitTableRegionState>
Copyright © 2007–2019 Cloudera. All rights reserved.