@InterfaceAudience.Private public class CloneSnapshotProcedure extends AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState>
StateMachineProcedure.Flow
Procedure.LockState
TableProcedureInterface.TableOperationType
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
private MonitoredTask |
monitorStatus |
private List<RegionInfo> |
newRegions |
private Map<String,Pair<String,String>> |
parentsToChildrenPairMap |
private boolean |
restoreAcl |
private org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription |
snapshot |
private TableDescriptor |
tableDescriptor |
private Boolean |
traceEnabled |
stateCount
NO_PROC_ID, NO_TIMEOUT
Constructor and Description |
---|
CloneSnapshotProcedure()
Constructor (for failover)
|
CloneSnapshotProcedure(MasterProcedureEnv env,
TableDescriptor tableDescriptor,
org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot) |
CloneSnapshotProcedure(MasterProcedureEnv env,
TableDescriptor tableDescriptor,
org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot,
boolean restoreAcl)
Constructor
|
Modifier and Type | Method and Description |
---|---|
private void |
addRegionsToMeta(MasterProcedureEnv env)
Add regions to hbase:meta table.
|
private List<RegionInfo> |
createFilesystemLayout(MasterProcedureEnv env,
TableDescriptor tableDescriptor,
List<RegionInfo> newRegions)
Create regions in file system.
|
private List<RegionInfo> |
createFsLayout(MasterProcedureEnv env,
TableDescriptor tableDescriptor,
List<RegionInfo> newRegions,
CreateTableProcedure.CreateHdfsRegions hdfsRegionHandler)
Create region layout in file system.
|
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.CloneSnapshotState state)
called to perform a single step of the specified 'state' of the procedure
|
protected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState |
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.CloneSnapshotState |
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.CloneSnapshotState 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.CloneSnapshotState 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 |
moveTempMobDirectoryToHBaseRoot(MasterFileSystem mfs,
TableDescriptor tableDescriptor,
org.apache.hadoop.fs.Path tempMobTableDir)
Move table temp mob directory to the hbase root location
|
private void |
postCloneSnapshot(MasterProcedureEnv env)
Action after cloning from snapshot.
|
private void |
preCloneSnapshot(MasterProcedureEnv env)
Action before cloning from snapshot.
|
private void |
prepareClone(MasterProcedureEnv env)
Action before any real action of cloning from snapshot.
|
private void |
restoreSnapshotAcl(MasterProcedureEnv env) |
protected void |
rollbackState(MasterProcedureEnv env,
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState 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, getRegionDir, getUser, getWALRegionDir, preflightChecks, releaseLock, releaseSyncLatch, setUser, waitInitialized
abort, 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 tableDescriptor
private org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot
private boolean restoreAcl
private List<RegionInfo> newRegions
private MonitoredTask monitorStatus
private Boolean traceEnabled
public CloneSnapshotProcedure()
public CloneSnapshotProcedure(MasterProcedureEnv env, TableDescriptor tableDescriptor, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot)
public CloneSnapshotProcedure(MasterProcedureEnv env, TableDescriptor tableDescriptor, org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription snapshot, boolean restoreAcl)
env
- MasterProcedureEnvtableDescriptor
- the table to operate onsnapshot
- snapshot to clone fromprivate MonitoredTask getMonitorStatus()
private void restoreSnapshotAcl(MasterProcedureEnv env) throws IOException
IOException
protected StateMachineProcedure.Flow executeFromState(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState state) throws InterruptedException
StateMachineProcedure
executeFromState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState>
state
- state to executeInterruptedException
protected void rollbackState(MasterProcedureEnv env, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState state) throws IOException
StateMachineProcedure
rollbackState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState>
state
- state to rollbackIOException
- temporary failure, the rollback will retry laterprotected boolean isRollbackSupported(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState state)
StateMachineProcedure
isRollbackSupported
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState>
protected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState getState(int stateId)
StateMachineProcedure
getState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState>
stateId
- the ordinal() of the state enum (or state id)protected int getStateId(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState state)
StateMachineProcedure
getStateId
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState>
state
- the state enum objectprotected org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState getInitialState()
StateMachineProcedure
getInitialState
in class StateMachineProcedure<MasterProcedureEnv,org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState>
public TableName getTableName()
getTableName
in interface TableProcedureInterface
getTableName
in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState>
public TableProcedureInterface.TableOperationType getTableOperationType()
TableProcedureInterface
getTableOperationType
in interface TableProcedureInterface
getTableOperationType
in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState>
public void toStringClassDetails(StringBuilder sb)
Procedure
toStringClassDetails
in class AbstractStateMachineTableProcedure<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CloneSnapshotState>
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.CloneSnapshotState>
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.CloneSnapshotState>
serializer
- contains the serialized stateIOException
private void prepareClone(MasterProcedureEnv env) throws IOException
env
- MasterProcedureEnvIOException
private void preCloneSnapshot(MasterProcedureEnv env) throws IOException, InterruptedException
env
- MasterProcedureEnvIOException
InterruptedException
private void postCloneSnapshot(MasterProcedureEnv env) throws IOException, InterruptedException
env
- MasterProcedureEnvIOException
InterruptedException
private List<RegionInfo> createFilesystemLayout(MasterProcedureEnv env, TableDescriptor tableDescriptor, List<RegionInfo> newRegions) throws IOException
env
- MasterProcedureEnvIOException
private List<RegionInfo> createFsLayout(MasterProcedureEnv env, TableDescriptor tableDescriptor, List<RegionInfo> newRegions, CreateTableProcedure.CreateHdfsRegions hdfsRegionHandler) throws IOException
env
- MasterProcedureEnvIOException
private void moveTempMobDirectoryToHBaseRoot(MasterFileSystem mfs, TableDescriptor tableDescriptor, org.apache.hadoop.fs.Path tempMobTableDir) throws IOException
mfs
- The master file systemtableDescriptor
- The table to operate ontempMobTableDir
- The temp mob directory of tableIOException
- If failed to move temp mob dir to hbase root dirprivate void addRegionsToMeta(MasterProcedureEnv env) throws IOException
env
- MasterProcedureEnvIOException
private Boolean isTraceEnabled()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.