Class CreateManyDatabasesProcedure
java.lang.Object
org.apache.iotdb.confignode.procedure.Procedure<Env>
org.apache.iotdb.confignode.procedure.impl.StateMachineProcedure<ConfigNodeProcedureEnv,Integer>
org.apache.iotdb.confignode.procedure.impl.testonly.CreateManyDatabasesProcedure
- All Implemented Interfaces:
Comparable<Procedure<ConfigNodeProcedureEnv>>
public class CreateManyDatabasesProcedure
extends StateMachineProcedure<ConfigNodeProcedureEnv,Integer>
This procedure will create numerous databases (perhaps 100), during which the confignode leader
should be externally shutdown to test whether the procedure can be correctly recovered after the
leader change. The procedure will never finish until it's recovered from another ConfigNode.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.iotdb.confignode.procedure.impl.StateMachineProcedure
StateMachineProcedure.Flow -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final intstatic final intstatic final longFields inherited from class org.apache.iotdb.confignode.procedure.impl.StateMachineProcedure
isGeneratedByPipeFields inherited from class org.apache.iotdb.confignode.procedure.Procedure
NO_PROC_ID, NO_TIMEOUT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserialize(ByteBuffer byteBuffer) protected StateMachineProcedure.FlowexecuteFromState(ConfigNodeProcedureEnv configNodeProcedureEnv, Integer state) Called to perform a single step of the specified 'state' of the procedure.protected IntegerReturn the initial state object that will be used for the first call to executeFromState().protected IntegergetState(int stateId) Convert an ordinal (or state id) to an Enum (or more descriptive) state object.protected intgetStateId(Integer integer) Convert the Enum (or more descriptive) state object to an ordinal (or state id).protected voidrollbackState(ConfigNodeProcedureEnv configNodeProcedureEnv, Integer integer) Called to perform the rollback of the specified state.voidserialize(DataOutputStream stream) Methods inherited from class org.apache.iotdb.confignode.procedure.impl.StateMachineProcedure
addChildProcedure, execute, getCurrentState, getCycles, isEofState, isRollbackSupported, isStateDeserialized, rollback, setNextState, toStringStateMethods inherited from class org.apache.iotdb.confignode.procedure.Procedure
acquireLock, addStackIndex, compareTo, deserializeTypeInfoForCompatibility, doAcquireLock, doExecute, doReleaseLock, doRollback, elapsedTime, getChildrenLatch, getException, getLastUpdate, getParentProcId, getProcId, getProcType, getResult, getRootProcId, getStackIndexes, getState, getSubmittedTime, getTimeout, getTimeoutTimestamp, hasChildren, hasException, hasLock, hasParent, hasTimeout, haveSameParent, holdLock, incChildrenLatch, isFailed, isFinished, isInitializing, isLockedWhenLoading, isRunnable, isSuccess, isWaiting, isYieldAfterExecution, releaseLock, removeStackIndex, restoreLock, setChildrenLatch, setFailure, setFailure, setLastUpdate, setParentProcId, setProcId, setProcRunnable, setResult, setRootProcedureId, setRootProcId, setStackIndexes, setState, setSubmittedTime, setTimeout, setTimeoutFailure, toString, toStringClassDetails, toStringDetails, toStringSimpleSB, updateMetricsOnFinish, updateMetricsOnSubmit, updateTimestamp, wasExecuted
-
Field Details
-
INITIAL_STATE
public static final int INITIAL_STATE- See Also:
-
MAX_STATE
public static final int MAX_STATE- See Also:
-
DATABASE_NAME_PREFIX
- See Also:
-
SLEEP_FOREVER
public static final long SLEEP_FOREVER- See Also:
-
-
Constructor Details
-
CreateManyDatabasesProcedure
public CreateManyDatabasesProcedure()
-
-
Method Details
-
executeFromState
protected StateMachineProcedure.Flow executeFromState(ConfigNodeProcedureEnv configNodeProcedureEnv, Integer state) throws InterruptedException Description copied from class:StateMachineProcedureCalled to perform a single step of the specified 'state' of the procedure.- Specified by:
executeFromStatein classStateMachineProcedure<ConfigNodeProcedureEnv,Integer> state- state to execute- Returns:
- Flow.NO_MORE_STATE if the procedure is completed, Flow.HAS_MORE_STATE if there is another step.
- Throws:
InterruptedException
-
rollbackState
protected void rollbackState(ConfigNodeProcedureEnv configNodeProcedureEnv, Integer integer) throws IOException, InterruptedException, ProcedureException Description copied from class:StateMachineProcedureCalled to perform the rollback of the specified state.- Specified by:
rollbackStatein classStateMachineProcedure<ConfigNodeProcedureEnv,Integer> integer- state to rollback- Throws:
IOException- temporary failure, the rollback will retry laterInterruptedExceptionProcedureException
-
getState
Description copied from class:StateMachineProcedureConvert an ordinal (or state id) to an Enum (or more descriptive) state object.- Specified by:
getStatein classStateMachineProcedure<ConfigNodeProcedureEnv,Integer> - Parameters:
stateId- the ordinal() of the state enum (or state id)- Returns:
- the state enum object
-
getStateId
Description copied from class:StateMachineProcedureConvert the Enum (or more descriptive) state object to an ordinal (or state id).- Specified by:
getStateIdin classStateMachineProcedure<ConfigNodeProcedureEnv,Integer> - Parameters:
integer- the state enum object- Returns:
- stateId the ordinal() of the state enum (or state id)
-
getInitialState
Description copied from class:StateMachineProcedureReturn the initial state object that will be used for the first call to executeFromState().- Specified by:
getInitialStatein classStateMachineProcedure<ConfigNodeProcedureEnv,Integer> - Returns:
- the initial state enum object
-
serialize
- Overrides:
serializein classStateMachineProcedure<ConfigNodeProcedureEnv,Integer> - Throws:
IOException
-
deserialize
- Overrides:
deserializein classStateMachineProcedure<ConfigNodeProcedureEnv,Integer>
-