@InterfaceAudience.Private public class TruncateTableProcedure extends AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState>
StateMachineProcedure.FlowProcedure.LockStateTableProcedureInterface.TableOperationType| Modifier and Type | Field and Description |
|---|---|
private static org.slf4j.Logger |
LOG |
private boolean |
preserveSplits |
private List<RegionInfo> |
regions |
private TableDescriptor |
tableDescriptor |
private TableName |
tableName |
stateCountNO_PROC_ID, NO_TIMEOUT| Constructor and Description |
|---|
TruncateTableProcedure() |
TruncateTableProcedure(MasterProcedureEnv env,
TableName tableName,
boolean preserveSplits) |
TruncateTableProcedure(MasterProcedureEnv env,
TableName tableName,
boolean preserveSplits,
ProcedurePrepareLatch latch) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
completionCleanup(MasterProcedureEnv env)
Called when the procedure is marked as completed (success or rollback).
|
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.TruncateTableState state)
called to perform a single step of the specified 'state' of the procedure
|
(package private) RegionInfo |
getFirstRegionInfo() |
protected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState |
getInitialState()
Return the initial state object that will be used for the first call to executeFromState().
|
protected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState |
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.TruncateTableState 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 |
holdLock(MasterProcedureEnv env)
Used to keep the procedure lock even when the procedure is yielding or suspended.
|
protected boolean |
isRollbackSupported(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState state)
Used by the default implementation of abort() to know if the current state can be aborted
and rollback can be triggered.
|
private void |
postTruncate(MasterProcedureEnv env) |
private boolean |
prepareTruncate(MasterProcedureEnv env) |
private boolean |
preTruncate(MasterProcedureEnv env) |
private static List<RegionInfo> |
recreateRegionInfo(List<RegionInfo> regions) |
protected void |
rollbackState(MasterProcedureEnv env,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState state)
called to perform the rollback of the specified state
|
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, checkOnline, checkTableModifiable, getUser, getWALRegionDir, preflightChecks, releaseLock, releaseSyncLatch, setUser, waitInitializedabort, addChildProcedure, execute, failIfAborted, getCurrentState, getCurrentStateId, getCycles, isEofState, isYieldAfterExecutionStep, isYieldBeforeExecuteFromState, rollback, setNextState, toStringStateaddStackIndex, 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, 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, wasExecutedprivate static final org.slf4j.Logger LOG
private boolean preserveSplits
private List<RegionInfo> regions
private TableDescriptor tableDescriptor
public TruncateTableProcedure()
public TruncateTableProcedure(MasterProcedureEnv env, TableName tableName, boolean preserveSplits) throws HBaseIOException
HBaseIOExceptionpublic TruncateTableProcedure(MasterProcedureEnv env, TableName tableName, boolean preserveSplits, ProcedurePrepareLatch latch) throws HBaseIOException
HBaseIOExceptionprotected StateMachineProcedure.Flow executeFromState(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState state) throws InterruptedException
StateMachineProcedureexecuteFromState in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState>state - state to executeInterruptedExceptionprotected void rollbackState(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState state)
StateMachineProcedurerollbackState in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState>state - state to rollbackprotected void completionCleanup(MasterProcedureEnv env)
ProcedurecompletionCleanup in class Procedure<MasterProcedureEnv>protected boolean isRollbackSupported(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState state)
StateMachineProcedureisRollbackSupported in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState>protected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState getState(int stateId)
StateMachineProceduregetState in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState>stateId - the ordinal() of the state enum (or state id)protected int getStateId(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState state)
StateMachineProceduregetStateId in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState>state - the state enum objectprotected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState getInitialState()
StateMachineProceduregetInitialState in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState>protected boolean holdLock(MasterProcedureEnv env)
ProcedureholdLock in class Procedure<MasterProcedureEnv>public TableName getTableName()
getTableName in interface TableProcedureInterfacegetTableName in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState>public TableProcedureInterface.TableOperationType getTableOperationType()
TableProcedureInterfacegetTableOperationType in interface TableProcedureInterfacegetTableOperationType in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState>public void toStringClassDetails(StringBuilder sb)
ProceduretoStringClassDetails in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState>sb - the string builder to use to append the proc specific informationprotected void serializeStateData(ProcedureStateSerializer serializer) throws IOException
ProcedureserializeStateData in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState>serializer - stores the serializable stateIOExceptionprotected void deserializeStateData(ProcedureStateSerializer serializer) throws IOException
ProceduredeserializeStateData in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.TruncateTableState>serializer - contains the serialized stateIOExceptionprivate static List<RegionInfo> recreateRegionInfo(List<RegionInfo> regions)
private boolean prepareTruncate(MasterProcedureEnv env) throws IOException
IOExceptionprivate boolean preTruncate(MasterProcedureEnv env) throws IOException, InterruptedException
IOExceptionInterruptedExceptionprivate void postTruncate(MasterProcedureEnv env) throws IOException, InterruptedException
IOExceptionInterruptedExceptionRegionInfo getFirstRegionInfo()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.