@InterfaceAudience.Private public class ModifyTableProcedure extends StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState> implements TableProcedureInterface
StateMachineProcedure.Flow
TableProcedureInterface.TableOperationType
Modifier and Type | Field and Description |
---|---|
private AtomicBoolean |
aborted |
private boolean |
deleteColumnFamilyInModify |
private static org.apache.commons.logging.Log |
LOG |
private HTableDescriptor |
modifiedHTableDescriptor |
private List<HRegionInfo> |
regionInfoList |
private Boolean |
traceEnabled |
private HTableDescriptor |
unmodifiedHTableDescriptor |
private org.apache.hadoop.security.UserGroupInformation |
user |
Constructor and Description |
---|
ModifyTableProcedure() |
ModifyTableProcedure(MasterProcedureEnv env,
HTableDescriptor htd) |
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.
|
private void |
deleteFromFs(MasterProcedureEnv env,
HTableDescriptor oldHTableDescriptor,
HTableDescriptor newHTableDescriptor)
Removes from hdfs the families that are not longer present in the new table descriptor.
|
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.ModifyTableState state)
called to perform a single step of the specified 'state' of the procedure
|
protected org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState |
getInitialState()
Return the initial state object that will be used for the first call to executeFromState().
|
private List<HRegionInfo> |
getRegionInfoList(MasterProcedureEnv env) |
protected org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState |
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.ModifyTableState 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 void |
initilize() |
private boolean |
isRollbackSupported(org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState state) |
private Boolean |
isTraceEnabled()
The procedure could be restarted from a different machine.
|
private void |
postModify(MasterProcedureEnv env,
org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState state)
Action after modifying table.
|
private void |
preModify(MasterProcedureEnv env,
org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState state)
Action before modifying table.
|
private void |
prepareModify(MasterProcedureEnv env)
Check conditions before any real action of modifying a table.
|
protected void |
releaseLock(MasterProcedureEnv env)
The user should override this method, and release lock if necessary.
|
private void |
reOpenAllRegionsIfTableIsOnline(MasterProcedureEnv env)
Last action from the procedure - executed when online schema change is supported.
|
private void |
restoreTableDescriptor(MasterProcedureEnv env)
Undo the descriptor change (for rollback)
|
protected void |
rollbackState(MasterProcedureEnv env,
org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState state)
called to perform the rollback of the specified state
|
private void |
runCoprocessorAction(MasterProcedureEnv env,
org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState 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.ModifyTableState state)
Set the next state for the procedure.
|
void |
toStringClassDetails(StringBuilder sb)
Extend the toString() information with the procedure details
e.g.
|
private void |
updateReplicaColumnsIfNeeded(MasterProcedureEnv env,
HTableDescriptor oldHTableDescriptor,
HTableDescriptor newHTableDescriptor)
update replica column families if necessary.
|
private void |
updateTableDescriptor(MasterProcedureEnv env)
Update descriptor
|
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 HTableDescriptor unmodifiedHTableDescriptor
private HTableDescriptor modifiedHTableDescriptor
private org.apache.hadoop.security.UserGroupInformation user
private boolean deleteColumnFamilyInModify
private List<HRegionInfo> regionInfoList
private Boolean traceEnabled
public ModifyTableProcedure()
public ModifyTableProcedure(MasterProcedureEnv env, HTableDescriptor htd)
private void initilize()
protected StateMachineProcedure.Flow executeFromState(MasterProcedureEnv env, org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState state) throws InterruptedException
StateMachineProcedure
executeFromState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState>
state
- state to executeInterruptedException
protected void rollbackState(MasterProcedureEnv env, org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState state) throws IOException
StateMachineProcedure
rollbackState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState>
state
- state to rollbackIOException
- temporary failure, the rollback will retry laterprotected org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState getState(int stateId)
StateMachineProcedure
getState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState>
stateId
- the ordinal() of the state enum (or state id)protected int getStateId(org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState state)
StateMachineProcedure
getStateId
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState>
state
- the state enum objectprotected org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState getInitialState()
StateMachineProcedure
getInitialState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState>
protected void setNextState(org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState state)
StateMachineProcedure
setNextState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState>
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.ModifyTableState>
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.ModifyTableState>
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 void prepareModify(MasterProcedureEnv env) throws IOException
env
- MasterProcedureEnvIOException
private void preModify(MasterProcedureEnv env, org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState state) throws IOException, InterruptedException
env
- MasterProcedureEnvstate
- the procedure stateIOException
InterruptedException
private void updateTableDescriptor(MasterProcedureEnv env) throws IOException
env
- MasterProcedureEnvIOException
private void restoreTableDescriptor(MasterProcedureEnv env) throws IOException
env
- MasterProcedureEnvIOException
private void deleteFromFs(MasterProcedureEnv env, HTableDescriptor oldHTableDescriptor, HTableDescriptor newHTableDescriptor) throws IOException
env
- MasterProcedureEnvIOException
private void updateReplicaColumnsIfNeeded(MasterProcedureEnv env, HTableDescriptor oldHTableDescriptor, HTableDescriptor newHTableDescriptor) throws IOException
env
- MasterProcedureEnvIOException
private void postModify(MasterProcedureEnv env, org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState state) throws IOException, InterruptedException
env
- MasterProcedureEnvstate
- the procedure stateIOException
InterruptedException
private void reOpenAllRegionsIfTableIsOnline(MasterProcedureEnv env) throws IOException
env
- MasterProcedureEnvIOException
private Boolean isTraceEnabled()
private void runCoprocessorAction(MasterProcedureEnv env, org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState state) throws IOException, InterruptedException
env
- MasterProcedureEnvstate
- the procedure stateIOException
InterruptedException
private boolean isRollbackSupported(org.apache.hadoop.hbase.protobuf.generated.MasterProcedureProtos.ModifyTableState state)
private List<HRegionInfo> getRegionInfoList(MasterProcedureEnv env) throws IOException
IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.