@InterfaceAudience.Private public class SnapshotProcedure extends AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState>
StateMachineProcedure.Flow
Procedure.LockState
TableProcedureInterface.TableOperationType
Modifier and Type | Field and Description |
---|---|
private org.apache.hadoop.conf.Configuration |
conf |
private TableDescriptor |
htd |
private static org.slf4j.Logger |
LOG |
private MetricsSnapshot |
metricsSnapshot |
private RetryCounter |
retryCounter |
private org.apache.hadoop.fs.Path |
rootDir |
private org.apache.hadoop.fs.FileSystem |
rootFs |
private org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription |
snapshot |
private org.apache.hadoop.fs.Path |
snapshotDir |
private SnapshotManifest |
snapshotManifest |
private TableName |
snapshotTable |
private MonitoredTask |
status |
private org.apache.hadoop.fs.Path |
workingDir |
private org.apache.hadoop.fs.FileSystem |
workingDirFS |
stateCount
NO_PROC_ID, NO_TIMEOUT
DUMMY_NAMESPACE_TABLE_NAME
Constructor and Description |
---|
SnapshotProcedure() |
SnapshotProcedure(MasterProcedureEnv env,
org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot) |
Modifier and Type | Method and Description |
---|---|
protected Procedure.LockState |
acquireLock(MasterProcedureEnv env)
The user should override this method if they need a lock on an Entity.
|
protected void |
afterReplay(MasterProcedureEnv env)
Called when the procedure is ready to be added to the queue after the loading/replay operation.
|
private void |
completeSnapshot(MasterProcedureEnv env) |
private Procedure<MasterProcedureEnv>[] |
createRemoteSnapshotProcedures(MasterProcedureEnv env) |
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.SnapshotState state)
called to perform a single step of the specified 'state' of the procedure
|
private Stream<RegionInfo> |
getDefaultRegionReplica(MasterProcedureEnv env) |
protected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState |
getInitialState()
Return the initial state object that will be used for the first call to executeFromState().
|
org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription |
getSnapshot() |
org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription |
getSnapshotDesc() |
protected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState |
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.SnapshotState state)
Convert the Enum (or more descriptive) state object to an ordinal (or state id).
|
TableName |
getTableName()
Returns the name of the table the procedure is operating on
|
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.
|
private boolean |
isAnySplitOrMergeProcedureRunning(MasterProcedureEnv env) |
protected boolean |
isRollbackSupported(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState state)
Used by the default implementation of abort() to know if the current state can be aborted and
rollback can be triggered.
|
boolean |
isSnapshotCorrupted() |
private TableDescriptor |
loadTableDescriptorSnapshot(MasterProcedureEnv env) |
void |
markSnapshotCorrupted() |
private void |
postSnapshot(MasterProcedureEnv env) |
private void |
prepareSnapshot(MasterProcedureEnv env) |
private void |
prepareSnapshotEnv(MasterProcedureEnv env) |
private void |
preSnapshot(MasterProcedureEnv env) |
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.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState 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.
|
protected boolean |
setTimeoutFailure(MasterProcedureEnv env)
Called by the ProcedureExecutor when the timeout set by setTimeout() is expired.
|
private void |
snapshotClosedRegions(MasterProcedureEnv env) |
private void |
snapshotMobRegion(MasterProcedureEnv env) |
private void |
snapshotSplitOrClosedRegions(MasterProcedureEnv env,
List<RegionInfo> regions,
String threadPoolName) |
private void |
snapshotSplitRegions(MasterProcedureEnv env) |
void |
toStringClassDetails(StringBuilder builder)
Extend the toString() information with the procedure details e.g.
|
private void |
verifySnapshot(MasterProcedureEnv env) |
checkOnline, checkTableModifiable, getUser, getWALRegionDir, isTableEnabled, preflightChecks, releaseSyncLatch, setUser, waitInitialized
abort, addChildProcedure, execute, failIfAborted, getCurrentState, getCurrentStateId, getCycles, isEofState, isRollbackSupported, isYieldAfterExecutionStep, isYieldBeforeExecuteFromState, rollback, setNextState, toStringState
addStackIndex, 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, incChildrenLatch, isBypass, isFailed, isFinished, isInitializing, isLockedWhenLoading, isRunnable, isSuccess, isWaiting, removeStackIndex, setAbortFailure, setChildrenLatch, setExecuted, setFailure, setFailure, setLastUpdate, setNonceKey, setOwner, setOwner, setParentProcId, setProcId, setResult, setRootProcId, setStackIndexes, setState, setSubmittedTime, setTimeout, shouldWaitClientAck, skipPersistence, suspend, toString, toStringClass, toStringDetails, toStringSimpleSB, updateMetricsOnFinish, updateMetricsOnSubmit, updateTimestamp, wasExecuted
private static final org.slf4j.Logger LOG
private final MetricsSnapshot metricsSnapshot
private org.apache.hadoop.conf.Configuration conf
private org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot
private org.apache.hadoop.fs.Path rootDir
private org.apache.hadoop.fs.Path snapshotDir
private org.apache.hadoop.fs.Path workingDir
private org.apache.hadoop.fs.FileSystem workingDirFS
private org.apache.hadoop.fs.FileSystem rootFs
private TableName snapshotTable
private MonitoredTask status
private SnapshotManifest snapshotManifest
private TableDescriptor htd
private RetryCounter retryCounter
public SnapshotProcedure()
public SnapshotProcedure(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot)
public TableName getTableName()
TableProcedureInterface
getTableName
in interface TableProcedureInterface
getTableName
in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState>
public TableProcedureInterface.TableOperationType getTableOperationType()
TableProcedureInterface
getTableOperationType
in interface TableProcedureInterface
getTableOperationType
in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState>
protected Procedure.LockState acquireLock(MasterProcedureEnv env)
Procedure
Procedure.execute(Object)
. It calls Procedure.releaseLock(Object)
after the call to
execute.
If you need to hold the lock for the life of the Procedure -- i.e. you do not want any other
Procedure interfering while this Procedure is running, see Procedure.holdLock(Object)
.
Example: in our Master we can execute request in parallel for different tables. We can create
t1 and create t2 and these creates can be executed at the same time. Anything else on t1/t2 is
queued waiting that specific table create to happen.
There are 3 LockState:
acquireLock
in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState>
protected void releaseLock(MasterProcedureEnv env)
Procedure
releaseLock
in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState>
protected boolean holdLock(MasterProcedureEnv env)
Procedure
holdLock
in class Procedure<MasterProcedureEnv>
protected StateMachineProcedure.Flow executeFromState(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState state) throws ProcedureSuspendedException, ProcedureYieldException, InterruptedException
StateMachineProcedure
executeFromState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState>
state
- state to executeProcedureSuspendedException
ProcedureYieldException
InterruptedException
protected void rollbackState(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState state) throws IOException, InterruptedException
StateMachineProcedure
rollbackState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState>
state
- state to rollbackIOException
- temporary failure, the rollback will retry laterInterruptedException
protected boolean isRollbackSupported(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState state)
StateMachineProcedure
isRollbackSupported
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState>
protected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState getState(int stateId)
StateMachineProcedure
getState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState>
stateId
- the ordinal() of the state enum (or state id)protected int getStateId(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState state)
StateMachineProcedure
getStateId
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState>
state
- the state enum objectprotected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState getInitialState()
StateMachineProcedure
getInitialState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState>
private void prepareSnapshot(MasterProcedureEnv env) throws ProcedureSuspendedException, IOException
private void prepareSnapshotEnv(MasterProcedureEnv env) throws IOException
IOException
protected boolean setTimeoutFailure(MasterProcedureEnv env)
Procedure
WAITING_TIMEOUT
by calling setState
method, and throw a
ProcedureSuspendedException
to halt the execution of the procedure, and do not forget a
call Procedure.setTimeout(int)
method to set the timeout. And you should also override this
method to wake up the procedure, and also return false to tell the ProcedureExecutor that the
timeout event has been handled.setTimeoutFailure
in class Procedure<MasterProcedureEnv>
private boolean isAnySplitOrMergeProcedureRunning(MasterProcedureEnv env)
private TableDescriptor loadTableDescriptorSnapshot(MasterProcedureEnv env) throws IOException
IOException
private void preSnapshot(MasterProcedureEnv env) throws IOException
IOException
private void postSnapshot(MasterProcedureEnv env) throws IOException
IOException
private void verifySnapshot(MasterProcedureEnv env) throws IOException
IOException
private void completeSnapshot(MasterProcedureEnv env) throws IOException
IOException
private void snapshotSplitRegions(MasterProcedureEnv env) throws IOException
IOException
private void snapshotClosedRegions(MasterProcedureEnv env) throws IOException
IOException
private Stream<RegionInfo> getDefaultRegionReplica(MasterProcedureEnv env)
private void snapshotSplitOrClosedRegions(MasterProcedureEnv env, List<RegionInfo> regions, String threadPoolName) throws IOException
IOException
private void snapshotMobRegion(MasterProcedureEnv env) throws IOException
IOException
protected void serializeStateData(ProcedureStateSerializer serializer) throws IOException
Procedure
serializeStateData
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState>
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.SnapshotState>
serializer
- contains the serialized stateIOException
private Procedure<MasterProcedureEnv>[] createRemoteSnapshotProcedures(MasterProcedureEnv env)
public void toStringClassDetails(StringBuilder builder)
Procedure
toStringClassDetails
in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SnapshotState>
builder
- the string builder to use to append the proc specific informationpublic org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription getSnapshotDesc()
protected void afterReplay(MasterProcedureEnv env)
Procedure
afterReplay
in class Procedure<MasterProcedureEnv>
public org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription getSnapshot()
public void markSnapshotCorrupted() throws IOException
IOException
public boolean isSnapshotCorrupted() throws IOException
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.