@InterfaceAudience.Private public class ModifyTableProcedure extends AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState>
StateMachineProcedure.Flow
Procedure.LockState
TableProcedureInterface.TableOperationType
Modifier and Type | Field and Description |
---|---|
private boolean |
deleteColumnFamilyInModify |
private static org.slf4j.Logger |
LOG |
private TableDescriptor |
modifiedTableDescriptor |
private boolean |
shouldCheckDescriptor |
private static List<byte[]> |
UNDELETABLE_META_COLUMNFAMILIES
List of column families that cannot be deleted from the hbase:meta table.
|
private TableDescriptor |
unmodifiedTableDescriptor |
stateCount
NO_PROC_ID, NO_TIMEOUT
Constructor and Description |
---|
ModifyTableProcedure() |
ModifyTableProcedure(MasterProcedureEnv env,
TableDescriptor htd) |
ModifyTableProcedure(MasterProcedureEnv env,
TableDescriptor htd,
ProcedurePrepareLatch latch) |
ModifyTableProcedure(MasterProcedureEnv env,
TableDescriptor newTableDescriptor,
ProcedurePrepareLatch latch,
TableDescriptor oldTableDescriptor,
boolean shouldCheckDescriptor) |
Modifier and Type | Method and Description |
---|---|
private static void |
addRegionsToMeta(MasterProcedureEnv env,
TableDescriptor tableDescriptor,
List<RegionInfo> regionInfos) |
protected void |
completionCleanup(MasterProcedureEnv env)
Called when the procedure is marked as completed (success or rollback).
|
private void |
deleteFromFs(MasterProcedureEnv env,
TableDescriptor oldTableDescriptor,
TableDescriptor newTableDescriptor)
Removes from hdfs the families that are not longer present in the new table descriptor.
|
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.ModifyTableState state)
called to perform a single step of the specified 'state' of the procedure
|
protected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState |
getInitialState()
Return the initial state object that will be used for the first call to executeFromState().
|
private List<RegionInfo> |
getRegionInfoList(MasterProcedureEnv env)
Fetches all Regions for a table.
|
protected org.apache.hadoop.hbase.shaded.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.shaded.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 |
initialize(TableDescriptor unmodifiedTableDescriptor,
boolean shouldCheckDescriptor) |
private static boolean |
isDeleteColumnFamily(TableDescriptor originalDescriptor,
TableDescriptor newDescriptor)
Find out whether all column families in unmodifiedTableDescriptor also exists in
the modifiedTableDescriptor.
|
protected boolean |
isRollbackSupported(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState state)
Used by the default implementation of abort() to know if the current state can be aborted
and rollback can be triggered.
|
private void |
postModify(MasterProcedureEnv env,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState state)
Action after modifying table.
|
protected void |
preflightChecks(MasterProcedureEnv env,
Boolean enabled)
Check that cluster is up and master is running.
|
private void |
preModify(MasterProcedureEnv env,
org.apache.hadoop.hbase.shaded.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 |
rollbackState(MasterProcedureEnv env,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState state)
called to perform the rollback of the specified state
|
private void |
runCoprocessorAction(MasterProcedureEnv env,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState state)
Coprocessor Action.
|
protected void |
serializeStateData(ProcedureStateSerializer serializer)
The user-level code of the procedure may have some state to
persist (e.g.
|
private void |
updateReplicaColumnsIfNeeded(MasterProcedureEnv env,
TableDescriptor oldTableDescriptor,
TableDescriptor newTableDescriptor)
update replica column families if necessary.
|
private void |
updateTableDescriptor(MasterProcedureEnv env)
Update descriptor
|
acquireLock, checkOnline, checkTableModifiable, getUser, getWALRegionDir, releaseLock, releaseSyncLatch, setUser, toStringClassDetails, waitInitialized
abort, addChildProcedure, execute, failIfAborted, getCurrentState, getCurrentStateId, getCycles, isEofState, isYieldAfterExecutionStep, isYieldBeforeExecuteFromState, rollback, setNextState, toStringState
addStackIndex, afterReplay, beforeReplay, bypass, compareTo, 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 TableDescriptor unmodifiedTableDescriptor
private TableDescriptor modifiedTableDescriptor
private boolean deleteColumnFamilyInModify
private boolean shouldCheckDescriptor
private static final List<byte[]> UNDELETABLE_META_COLUMNFAMILIES
public ModifyTableProcedure()
public ModifyTableProcedure(MasterProcedureEnv env, TableDescriptor htd) throws HBaseIOException
HBaseIOException
public ModifyTableProcedure(MasterProcedureEnv env, TableDescriptor htd, ProcedurePrepareLatch latch) throws HBaseIOException
HBaseIOException
public ModifyTableProcedure(MasterProcedureEnv env, TableDescriptor newTableDescriptor, ProcedurePrepareLatch latch, TableDescriptor oldTableDescriptor, boolean shouldCheckDescriptor) throws HBaseIOException
HBaseIOException
protected void preflightChecks(MasterProcedureEnv env, Boolean enabled) throws HBaseIOException
AbstractStateMachineTableProcedure
enabled
, check table is enabled else check it is disabled.
Call in Procedure constructor so can pass any exception to caller.preflightChecks
in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState>
enabled
- If true, check table is enabled and throw exception if not. If false, do the
inverse. If null, do no table checks.HBaseIOException
private void initialize(TableDescriptor unmodifiedTableDescriptor, boolean shouldCheckDescriptor)
protected StateMachineProcedure.Flow executeFromState(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState state) throws InterruptedException
StateMachineProcedure
executeFromState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState>
state
- state to executeInterruptedException
protected void rollbackState(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState state) throws IOException
StateMachineProcedure
rollbackState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState>
state
- state to rollbackIOException
- temporary failure, the rollback will retry laterprotected boolean isRollbackSupported(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState state)
StateMachineProcedure
isRollbackSupported
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState>
protected void completionCleanup(MasterProcedureEnv env)
Procedure
completionCleanup
in class Procedure<MasterProcedureEnv>
protected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState getState(int stateId)
StateMachineProcedure
getState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState>
stateId
- the ordinal() of the state enum (or state id)protected int getStateId(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState state)
StateMachineProcedure
getStateId
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState>
state
- the state enum objectprotected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState getInitialState()
StateMachineProcedure
getInitialState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState>
protected void serializeStateData(ProcedureStateSerializer serializer) throws IOException
Procedure
serializeStateData
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState>
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.ModifyTableState>
serializer
- contains the serialized stateIOException
public TableName getTableName()
getTableName
in interface TableProcedureInterface
getTableName
in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState>
public TableProcedureInterface.TableOperationType getTableOperationType()
TableProcedureInterface
getTableOperationType
in interface TableProcedureInterface
getTableOperationType
in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState>
private void prepareModify(MasterProcedureEnv env) throws IOException
env
- MasterProcedureEnvIOException
private static boolean isDeleteColumnFamily(TableDescriptor originalDescriptor, TableDescriptor newDescriptor)
private void preModify(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.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 deleteFromFs(MasterProcedureEnv env, TableDescriptor oldTableDescriptor, TableDescriptor newTableDescriptor) throws IOException
env
- MasterProcedureEnvIOException
private void updateReplicaColumnsIfNeeded(MasterProcedureEnv env, TableDescriptor oldTableDescriptor, TableDescriptor newTableDescriptor) throws IOException
env
- MasterProcedureEnvIOException
private static void addRegionsToMeta(MasterProcedureEnv env, TableDescriptor tableDescriptor, List<RegionInfo> regionInfos) throws IOException
IOException
private void postModify(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState state) throws IOException, InterruptedException
env
- MasterProcedureEnvstate
- the procedure stateIOException
InterruptedException
private void runCoprocessorAction(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.ModifyTableState state) throws IOException, InterruptedException
env
- MasterProcedureEnvstate
- the procedure stateIOException
InterruptedException
private List<RegionInfo> getRegionInfoList(MasterProcedureEnv env) throws IOException
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.