@InterfaceAudience.Private public class EnableTableProcedure extends StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState> implements TableProcedureInterface
StateMachineProcedure.Flow
TableProcedureInterface.TableOperationType
Modifier and Type | Field and Description |
---|---|
private AtomicBoolean |
aborted |
private static org.apache.commons.logging.Log |
LOG |
private boolean |
skipTableStateCheck |
private ProcedurePrepareLatch |
syncLatch |
private TableName |
tableName |
private Boolean |
traceEnabled |
private org.apache.hadoop.security.UserGroupInformation |
user |
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 |
---|---|
boolean |
abort(MasterProcedureEnv env)
The abort() call is asynchronous and each procedure must decide how to deal
with that, if they want to be abortable.
|
protected boolean |
acquireLock(MasterProcedureEnv env)
The user should override this method, and try to take a lock if necessary.
|
void |
deserializeStateData(InputStream stream)
Called on store load to allow the user to decode the previously serialized
state.
|
protected StateMachineProcedure.Flow |
executeFromState(MasterProcedureEnv env,
org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState state)
called to perform a single step of the specified 'state' of the procedure
|
protected org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState |
getInitialState()
Return the initial state object that will be used for the first call to executeFromState().
|
protected org.apache.hadoop.hbase.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.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.
|
private Boolean |
isTraceEnabled()
The procedure could be restarted from a different machine.
|
private void |
markRegionsOfflineDuringRecovery(MasterProcedureEnv env)
Mark regions of the table offline during recovery
|
private static boolean |
markRegionsOnline(MasterProcedureEnv env,
TableName tableName)
Mark offline regions of the table online
|
protected static void |
markRegionsOnline(MasterProcedureEnv env,
TableName tableName,
Boolean retryRequired)
Mark offline regions of the table online with retry
|
private void |
postEnable(MasterProcedureEnv env,
org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState state)
Action after enabling table.
|
private void |
preEnable(MasterProcedureEnv env,
org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState state)
Action before enabling table.
|
private boolean |
prepareEnable(MasterProcedureEnv env)
Action before any real action of enabling table.
|
private static Map<HRegionInfo,ServerName> |
regionsToAssignWithServerName(MasterProcedureEnv env,
List<Pair<HRegionInfo,ServerName>> regionsInMeta) |
protected void |
releaseLock(MasterProcedureEnv env)
The user should override this method, and release lock if necessary.
|
protected void |
rollbackState(MasterProcedureEnv env,
org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState state)
called to perform the rollback of the specified state
|
private void |
runCoprocessorAction(MasterProcedureEnv env,
org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState state)
Coprocessor Action.
|
void |
serializeStateData(OutputStream stream)
The user-level code of the procedure may have some state to
persist (e.g.
|
protected void |
setNextState(org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState state)
Set the next state for the procedure.
|
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
|
void |
toStringClassDetails(StringBuilder sb)
Extend the toString() information with the procedure details
e.g.
|
execute, isYieldAfterExecutionStep, isYieldBeforeExecuteFromState, rollback, toStringState
addStackIndex, beforeReplay, childrenCountDown, compareTo, completionCleanup, convert, convert, createProcedureInfo, doExecute, doRollback, elapsedTime, getException, getLastUpdate, getNonceKey, getOwner, getParentProcId, getProcId, getProcIdHashCode, getResult, getRootProcedureId, getStackIndexes, getStartTime, getState, getTimeout, getTimeRemaining, hasException, hasOwner, hasParent, hasTimeout, incChildrenLatch, isFailed, isFinished, isSuccess, isWaiting, newInstance, removeStackIndex, setAbortFailure, setChildrenLatch, setFailure, setFailure, setNonceKey, setOwner, setParentProcId, setProcId, setResult, setStackIndexes, setStartTime, setState, setTimeout, setTimeoutFailure, shouldWaitClientAck, toString, toStringClass, toStringDetails, toStringSimpleSB, updateTimestamp, validateClass, wasExecuted
private static final org.apache.commons.logging.Log LOG
private final AtomicBoolean aborted
private final ProcedurePrepareLatch syncLatch
private TableName tableName
private boolean skipTableStateCheck
private org.apache.hadoop.security.UserGroupInformation user
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.protobuf.generated.MasterProcedureProtos.EnableTableState state) throws InterruptedException
StateMachineProcedure
executeFromState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState>
state
- state to executeInterruptedException
protected void rollbackState(MasterProcedureEnv env, org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState state) throws IOException
StateMachineProcedure
rollbackState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState>
state
- state to rollbackIOException
- temporary failure, the rollback will retry laterprotected org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState getState(int stateId)
StateMachineProcedure
getState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState>
stateId
- the ordinal() of the state enum (or state id)protected int getStateId(org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState state)
StateMachineProcedure
getStateId
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState>
state
- the state enum objectprotected org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState getInitialState()
StateMachineProcedure
getInitialState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState>
protected void setNextState(org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState state)
StateMachineProcedure
setNextState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState>
state
- the state enum objectpublic boolean abort(MasterProcedureEnv env)
Procedure
abort
in class Procedure<MasterProcedureEnv>
protected boolean acquireLock(MasterProcedureEnv env)
Procedure
acquireLock
in class Procedure<MasterProcedureEnv>
protected void releaseLock(MasterProcedureEnv env)
Procedure
releaseLock
in class Procedure<MasterProcedureEnv>
public void serializeStateData(OutputStream stream) throws IOException
Procedure
serializeStateData
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState>
stream
- the stream that will contain the user serialized dataIOException
public void deserializeStateData(InputStream stream) throws IOException
Procedure
deserializeStateData
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState>
stream
- the stream that contains the user serialized dataIOException
public void toStringClassDetails(StringBuilder sb)
Procedure
toStringClassDetails
in class Procedure<MasterProcedureEnv>
sb
- the string builder to use to append the proc specific informationpublic TableName getTableName()
getTableName
in interface TableProcedureInterface
public TableProcedureInterface.TableOperationType getTableOperationType()
TableProcedureInterface
getTableOperationType
in interface TableProcedureInterface
private boolean prepareEnable(MasterProcedureEnv env) throws IOException
env
- MasterProcedureEnvIOException
private void preEnable(MasterProcedureEnv env, org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState state) throws IOException, InterruptedException
env
- MasterProcedureEnvstate
- the procedure stateIOException
InterruptedException
protected static void setTableStateToEnabling(MasterProcedureEnv env, TableName tableName) throws HBaseException, IOException
env
- MasterProcedureEnvtableName
- the target tableIOException
HBaseException
protected static void markRegionsOnline(MasterProcedureEnv env, TableName tableName, Boolean retryRequired) throws IOException
env
- MasterProcedureEnvtableName
- the target tableretryRequired
- whether to retry if the first run failedIOException
private static boolean markRegionsOnline(MasterProcedureEnv env, TableName tableName) throws IOException
env
- MasterProcedureEnvtableName
- the target tableIOException
private void markRegionsOfflineDuringRecovery(MasterProcedureEnv env)
env
- MasterProcedureEnvprotected static void setTableStateToEnabled(MasterProcedureEnv env, TableName tableName) throws HBaseException, IOException
env
- MasterProcedureEnvIOException
HBaseException
private void postEnable(MasterProcedureEnv env, org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState state) throws IOException, InterruptedException
env
- MasterProcedureEnvstate
- the procedure stateIOException
InterruptedException
private Boolean isTraceEnabled()
private static Map<HRegionInfo,ServerName> regionsToAssignWithServerName(MasterProcedureEnv env, List<Pair<HRegionInfo,ServerName>> regionsInMeta) throws IOException
regionsInMeta
- IOException
private void runCoprocessorAction(MasterProcedureEnv env, org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.EnableTableState state) throws IOException, InterruptedException
env
- MasterProcedureEnvstate
- the procedure stateIOException
InterruptedException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.