@InterfaceAudience.Private public class EnableTableProcedure extends AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState>
StateMachineProcedure.Flow
Procedure.LockState
TableProcedureInterface.TableOperationType
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
private boolean |
skipTableStateCheck |
private TableName |
tableName |
private Boolean |
traceEnabled |
stateCount
NO_PROC_ID, NO_TIMEOUT
Constructor and Description |
---|
EnableTableProcedure() |
EnableTableProcedure(MasterProcedureEnv env,
TableName tableName,
boolean skipTableStateCheck)
Constructor
|
EnableTableProcedure(MasterProcedureEnv env,
TableName tableName,
boolean skipTableStateCheck,
ProcedurePrepareLatch syncLatch)
Constructor
|
Modifier and Type | Method and Description |
---|---|
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,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState state)
called to perform a single step of the specified 'state' of the procedure
|
protected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState |
getInitialState()
Return the initial state object that will be used for the first call to executeFromState().
|
private int |
getNumberOfReplicasFromMeta(Connection connection,
int regionReplicaCount,
List<RegionInfo> regionsOfTable) |
private Result |
getRegionFromMeta(Connection connection,
List<RegionInfo> regionsOfTable) |
protected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState |
getState(int stateId)
Convert an ordinal (or state id) to an Enum (or more descriptive) state object.
|
protected int |
getStateId(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState state)
Convert the Enum (or more descriptive) state object to an ordinal (or state id).
|
TableName |
getTableName() |
TableProcedureInterface.TableOperationType |
getTableOperationType()
Given an operation type we can take decisions about what to do with pending operations.
|
protected boolean |
isRollbackSupported(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState state)
Used by the default implementation of abort() to know if the current state can be aborted
and rollback can be triggered.
|
private Boolean |
isTraceEnabled()
The procedure could be restarted from a different machine.
|
private void |
postEnable(MasterProcedureEnv env,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState state)
Action after enabling table.
|
private void |
preEnable(MasterProcedureEnv env,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState state)
Action before enabling table.
|
private boolean |
prepareEnable(MasterProcedureEnv env)
Action before any real action of enabling table.
|
protected void |
rollbackState(MasterProcedureEnv env,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState state)
called to perform the rollback of the specified state
|
private void |
runCoprocessorAction(MasterProcedureEnv env,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState state)
Coprocessor Action.
|
protected void |
serializeStateData(ProcedureStateSerializer serializer)
The user-level code of the procedure may have some state to
persist (e.g.
|
protected static void |
setTableStateToEnabled(MasterProcedureEnv env,
TableName tableName)
Mark table state to Enabled
|
protected static void |
setTableStateToEnabling(MasterProcedureEnv env,
TableName tableName)
Mark table state to Enabling
|
acquireLock, checkOnline, checkTableModifiable, getRegionDir, getUser, getWALRegionDir, preflightChecks, releaseLock, releaseSyncLatch, setUser, toStringClassDetails, waitInitialized
abort, 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, 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, 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
private static final org.slf4j.Logger LOG
private boolean skipTableStateCheck
private Boolean traceEnabled
public EnableTableProcedure()
public EnableTableProcedure(MasterProcedureEnv env, TableName tableName, boolean skipTableStateCheck)
env
- MasterProcedureEnvtableName
- the table to operate onskipTableStateCheck
- whether to check table statepublic EnableTableProcedure(MasterProcedureEnv env, TableName tableName, boolean skipTableStateCheck, ProcedurePrepareLatch syncLatch)
env
- MasterProcedureEnvtableName
- the table to operate onskipTableStateCheck
- whether to check table stateprotected StateMachineProcedure.Flow executeFromState(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState state) throws InterruptedException
StateMachineProcedure
executeFromState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState>
state
- state to executeInterruptedException
private int getNumberOfReplicasFromMeta(Connection connection, int regionReplicaCount, List<RegionInfo> regionsOfTable) throws IOException
IOException
private Result getRegionFromMeta(Connection connection, List<RegionInfo> regionsOfTable) throws IOException
IOException
protected void rollbackState(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState state) throws IOException
StateMachineProcedure
rollbackState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState>
state
- state to rollbackIOException
- temporary failure, the rollback will retry laterprotected boolean isRollbackSupported(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState state)
StateMachineProcedure
isRollbackSupported
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState>
protected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState getState(int stateId)
StateMachineProcedure
getState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState>
stateId
- the ordinal() of the state enum (or state id)protected int getStateId(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState state)
StateMachineProcedure
getStateId
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState>
state
- the state enum objectprotected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState getInitialState()
StateMachineProcedure
getInitialState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState>
protected void serializeStateData(ProcedureStateSerializer serializer) throws IOException
Procedure
serializeStateData
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState>
serializer
- stores the serializable stateIOException
protected void deserializeStateData(ProcedureStateSerializer serializer) throws IOException
Procedure
deserializeStateData
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState>
serializer
- contains the serialized stateIOException
public TableName getTableName()
getTableName
in interface TableProcedureInterface
getTableName
in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState>
public TableProcedureInterface.TableOperationType getTableOperationType()
TableProcedureInterface
getTableOperationType
in interface TableProcedureInterface
getTableOperationType
in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState>
private boolean prepareEnable(MasterProcedureEnv env) throws IOException
env
- MasterProcedureEnvIOException
private void preEnable(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState state) throws IOException, InterruptedException
env
- MasterProcedureEnvstate
- the procedure stateIOException
InterruptedException
protected static void setTableStateToEnabling(MasterProcedureEnv env, TableName tableName) throws IOException
env
- MasterProcedureEnvtableName
- the target tableIOException
protected static void setTableStateToEnabled(MasterProcedureEnv env, TableName tableName) throws IOException
env
- MasterProcedureEnvIOException
private void postEnable(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState state) throws IOException, InterruptedException
env
- MasterProcedureEnvstate
- the procedure stateIOException
InterruptedException
private Boolean isTraceEnabled()
private void runCoprocessorAction(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.EnableTableState state) throws IOException, InterruptedException
env
- MasterProcedureEnvstate
- the procedure stateIOException
InterruptedException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.