@InterfaceAudience.Private public class RestoreSnapshotProcedure extends AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState>
StateMachineProcedure.Flow
Procedure.LockState
TableProcedureInterface.TableOperationType
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
private TableDescriptor |
modifiedTableDescriptor |
private MonitoredTask |
monitorStatus |
private Map<String,Pair<String,String>> |
parentsToChildrenPairMap |
private List<RegionInfo> |
regionsToAdd |
private List<RegionInfo> |
regionsToRemove |
private List<RegionInfo> |
regionsToRestore |
private boolean |
restoreAcl |
private org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription |
snapshot |
private Boolean |
traceEnabled |
stateCount
NO_PROC_ID, NO_TIMEOUT
Constructor and Description |
---|
RestoreSnapshotProcedure()
Constructor (for failover)
|
RestoreSnapshotProcedure(MasterProcedureEnv env,
TableDescriptor tableDescriptor,
org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot) |
RestoreSnapshotProcedure(MasterProcedureEnv env,
TableDescriptor tableDescriptor,
org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot,
boolean restoreAcl)
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 it, if they want to be abortable.
|
private void |
addRegionsToInMemoryStates(List<RegionInfo> regionInfos,
MasterProcedureEnv env,
int regionReplication)
Add regions to in-memory states
|
private void |
deleteRegionsFromInMemoryStates(List<RegionInfo> regionInfos,
MasterProcedureEnv env,
int regionReplication)
Delete regions from in-memory states
|
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.RestoreSnapshotState state)
called to perform a single step of the specified 'state' of the procedure
|
protected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState |
getInitialState()
Return the initial state object that will be used for the first call to executeFromState().
|
private MonitoredTask |
getMonitorStatus()
Set up monitor status if it is not created.
|
protected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState |
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.RestoreSnapshotState 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 |
isRollbackSupported(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState state)
Used by the default implementation of abort() to know if the current state can be aborted
and rollback can be triggered.
|
private Boolean |
isTraceEnabled()
The procedure could be restarted from a different machine.
|
private void |
prepareRestore(MasterProcedureEnv env)
Action before any real action of restoring from snapshot.
|
private void |
restoreSnapshot(MasterProcedureEnv env)
Execute the on-disk Restore
|
private void |
restoreSnapshotAcl(MasterProcedureEnv env) |
protected void |
rollbackState(MasterProcedureEnv env,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState 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.
|
private void |
updateMETA(MasterProcedureEnv env)
Apply changes to hbase:meta
|
private void |
updateTableDescriptor(MasterProcedureEnv env)
Update descriptor
|
acquireLock, checkOnline, checkTableModifiable, getRegionDir, getUser, getWALRegionDir, preflightChecks, releaseLock, releaseSyncLatch, setUser, waitInitialized
addChildProcedure, execute, failIfAborted, getCurrentState, getCurrentStateId, getCycles, isEofState, isYieldAfterExecutionStep, isYieldBeforeExecuteFromState, rollback, setNextState, toStringState
addStackIndex, afterReplay, 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, 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 modifiedTableDescriptor
private List<RegionInfo> regionsToRestore
private List<RegionInfo> regionsToRemove
private List<RegionInfo> regionsToAdd
private org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot
private boolean restoreAcl
private MonitoredTask monitorStatus
private Boolean traceEnabled
public RestoreSnapshotProcedure()
public RestoreSnapshotProcedure(MasterProcedureEnv env, TableDescriptor tableDescriptor, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot) throws HBaseIOException
HBaseIOException
public RestoreSnapshotProcedure(MasterProcedureEnv env, TableDescriptor tableDescriptor, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot, boolean restoreAcl) throws HBaseIOException
env
- MasterProcedureEnvtableDescriptor
- the table to operate onsnapshot
- snapshot to restore fromIOException
HBaseIOException
private MonitoredTask getMonitorStatus()
protected StateMachineProcedure.Flow executeFromState(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState state) throws InterruptedException
StateMachineProcedure
executeFromState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState>
state
- state to executeInterruptedException
protected void rollbackState(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState state) throws IOException
StateMachineProcedure
rollbackState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState>
state
- state to rollbackIOException
- temporary failure, the rollback will retry laterprotected boolean isRollbackSupported(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState state)
StateMachineProcedure
isRollbackSupported
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState>
protected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState getState(int stateId)
StateMachineProcedure
getState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState>
stateId
- the ordinal() of the state enum (or state id)protected int getStateId(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState state)
StateMachineProcedure
getStateId
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState>
state
- the state enum objectprotected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState getInitialState()
StateMachineProcedure
getInitialState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState>
public TableName getTableName()
getTableName
in interface TableProcedureInterface
getTableName
in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState>
public TableProcedureInterface.TableOperationType getTableOperationType()
TableProcedureInterface
getTableOperationType
in interface TableProcedureInterface
getTableOperationType
in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState>
public boolean abort(MasterProcedureEnv env)
Procedure
NOTE: abort() is not like Thread.interrupt(). It is just a notification that allows the procedure implementor abort.
abort
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState>
public void toStringClassDetails(StringBuilder sb)
Procedure
toStringClassDetails
in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState>
sb
- the string builder to use to append the proc specific informationprotected void serializeStateData(ProcedureStateSerializer serializer) throws IOException
Procedure
serializeStateData
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RestoreSnapshotState>
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.RestoreSnapshotState>
serializer
- contains the serialized stateIOException
private void prepareRestore(MasterProcedureEnv env) throws IOException
env
- MasterProcedureEnvIOException
private void updateTableDescriptor(MasterProcedureEnv env) throws IOException
env
- MasterProcedureEnvIOException
private void restoreSnapshot(MasterProcedureEnv env) throws IOException
env
- MasterProcedureEnvIOException
private void updateMETA(MasterProcedureEnv env) throws IOException
env
- MasterProcedureEnvIOException
private void deleteRegionsFromInMemoryStates(List<RegionInfo> regionInfos, MasterProcedureEnv env, int regionReplication)
regionInfos
- regions to deleteenv
- MasterProcedureEnvregionReplication
- the number of region replicationsprivate void addRegionsToInMemoryStates(List<RegionInfo> regionInfos, MasterProcedureEnv env, int regionReplication)
regionInfos
- regions to addenv
- MasterProcedureEnvregionReplication
- the number of region replicationsprivate void restoreSnapshotAcl(MasterProcedureEnv env) throws IOException
IOException
private Boolean isTraceEnabled()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.