Class MasterProcedureTestingUtility
java.lang.Object
org.apache.hadoop.hbase.master.procedure.MasterProcedureTestingUtility
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static interface
Hook which will be executed on each step -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static int
countMetaRegions
(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName) static org.apache.hadoop.hbase.client.TableDescriptor
private static org.apache.hadoop.hbase.client.Put
createPut
(byte[][] families, byte[] key, byte[] value) static org.apache.hadoop.hbase.client.RegionInfo[]
createTable
(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec, org.apache.hadoop.hbase.TableName tableName, byte[][] splitKeys, String... family) static long
generateNonce
(org.apache.hadoop.hbase.master.HMaster master) static long
generateNonceGroup
(org.apache.hadoop.hbase.master.HMaster master) static void
loadData
(org.apache.hadoop.hbase.client.Connection connection, org.apache.hadoop.hbase.TableName tableName, int rows, byte[][] splitKeys, String... sfamilies) static void
masterFailover
(HBaseTestingUtility testUtil) static void
restartMasterProcedureExecutor
(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec) static boolean
tableExists
(org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.TableName tableName) static void
testRecoveryAndDoubleExecution
(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec, long procId) static void
testRecoveryAndDoubleExecution
(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec, long procId, int lastStep, boolean expectExecRunning) Run through all procedure flow states TWICE while also restarting procedure executor at each step; i.e force a reread of procedure store.static void
testRecoveryAndDoubleExecution
(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec, long procId, MasterProcedureTestingUtility.StepHook hook) Run through all procedure flow states TWICE while also restarting procedure executor at each step; i.e force a reread of procedure store.static void
testRestartWithAbort
(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec, long procId) Restart the ProcedureExecutor and inject an abort to the specified procedure.static void
testRollbackAndDoubleExecution
(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec, long procId, int lastStep) Execute the procedure up to "lastStep" and then the ProcedureExecutor is restarted and an abort() is injected.static void
testRollbackAndDoubleExecution
(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec, long procId, int lastStep, boolean waitForAsyncProcs) static void
testRollbackRetriableFailure
(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec, long procId, int lastStep) Execute the procedure up to "lastStep" and then the ProcedureExecutor is restarted and an abort() is injected.static void
validateColumnFamilyAddition
(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName, String family) static void
validateColumnFamilyDeletion
(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName, String family) static void
validateColumnFamilyModification
(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName, String family, org.apache.hadoop.hbase.client.ColumnFamilyDescriptor columnDescriptor) static void
validateTableCreation
(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName, org.apache.hadoop.hbase.client.RegionInfo[] regions, boolean hasFamilyDirs, String... family) static void
validateTableCreation
(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName, org.apache.hadoop.hbase.client.RegionInfo[] regions, String... family) static void
validateTableDeletion
(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName) static void
validateTableIsDisabled
(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName) static void
validateTableIsEnabled
(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName) static void
waitBackupMaster
(HBaseTestingUtility testUtil, org.apache.hadoop.hbase.master.HMaster oldMaster)
-
Field Details
-
LOG
-
-
Constructor Details
-
MasterProcedureTestingUtility
private MasterProcedureTestingUtility()
-
-
Method Details
-
restartMasterProcedureExecutor
public static void restartMasterProcedureExecutor(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec) throws Exception - Throws:
Exception
-
masterFailover
- Throws:
Exception
-
waitBackupMaster
public static void waitBackupMaster(HBaseTestingUtility testUtil, org.apache.hadoop.hbase.master.HMaster oldMaster) throws Exception - Throws:
Exception
-
createHTD
-
createTable
public static org.apache.hadoop.hbase.client.RegionInfo[] createTable(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec, org.apache.hadoop.hbase.TableName tableName, byte[][] splitKeys, String... family) throws IOException - Throws:
IOException
-
validateTableCreation
public static void validateTableCreation(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName, org.apache.hadoop.hbase.client.RegionInfo[] regions, String... family) throws IOException - Throws:
IOException
-
validateTableCreation
public static void validateTableCreation(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName, org.apache.hadoop.hbase.client.RegionInfo[] regions, boolean hasFamilyDirs, String... family) throws IOException - Throws:
IOException
-
validateTableDeletion
public static void validateTableDeletion(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName) throws IOException - Throws:
IOException
-
countMetaRegions
private static int countMetaRegions(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName) throws IOException - Throws:
IOException
-
validateTableIsEnabled
public static void validateTableIsEnabled(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName) throws IOException - Throws:
IOException
-
validateTableIsDisabled
public static void validateTableIsDisabled(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName) throws IOException - Throws:
IOException
-
validateColumnFamilyAddition
public static void validateColumnFamilyAddition(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName, String family) throws IOException - Throws:
IOException
-
validateColumnFamilyDeletion
public static void validateColumnFamilyDeletion(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName, String family) throws IOException - Throws:
IOException
-
validateColumnFamilyModification
public static void validateColumnFamilyModification(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName, String family, org.apache.hadoop.hbase.client.ColumnFamilyDescriptor columnDescriptor) throws IOException - Throws:
IOException
-
loadData
public static void loadData(org.apache.hadoop.hbase.client.Connection connection, org.apache.hadoop.hbase.TableName tableName, int rows, byte[][] splitKeys, String... sfamilies) throws IOException - Throws:
IOException
-
createPut
private static org.apache.hadoop.hbase.client.Put createPut(byte[][] families, byte[] key, byte[] value) -
generateNonceGroup
-
generateNonce
-
testRecoveryAndDoubleExecution
public static void testRecoveryAndDoubleExecution(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec, long procId, int lastStep, boolean expectExecRunning) throws Exception Run through all procedure flow states TWICE while also restarting procedure executor at each step; i.e force a reread of procedure store.It does
- Execute step N - kill the executor before store update
- Restart executor/store
- Execute step N - and then save to store
This is a good test for finding state that needs persisting and steps that are not idempotent. Use this version of the test when a procedure executes all flow steps from start to finish.
- Throws:
Exception
- See Also:
-
testRecoveryAndDoubleExecution
public static void testRecoveryAndDoubleExecution(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec, long procId, MasterProcedureTestingUtility.StepHook hook) throws Exception Run through all procedure flow states TWICE while also restarting procedure executor at each step; i.e force a reread of procedure store.It does
- Execute step N - kill the executor before store update
- Restart executor/store
- Executes hook for each step twice
- Execute step N - and then save to store
This is a good test for finding state that needs persisting and steps that are not idempotent. Use this version of the test when the order in which flow steps are executed is not start to finish; where the procedure may vary the flow steps dependent on circumstance found.
-
testRecoveryAndDoubleExecution
public static void testRecoveryAndDoubleExecution(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec, long procId) throws Exception - Throws:
Exception
-
testRollbackAndDoubleExecution
public static void testRollbackAndDoubleExecution(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec, long procId, int lastStep) throws Exception Execute the procedure up to "lastStep" and then the ProcedureExecutor is restarted and an abort() is injected. If the procedure implement abort() this should result in rollback being triggered. Each rollback step is called twice, by restarting the executor after every step. At the end of this call the procedure should be finished and rolledback. This method assert on the procedure being terminated with an AbortException.- Throws:
Exception
-
testRollbackAndDoubleExecution
public static void testRollbackAndDoubleExecution(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec, long procId, int lastStep, boolean waitForAsyncProcs) throws Exception - Throws:
Exception
-
testRollbackRetriableFailure
public static void testRollbackRetriableFailure(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec, long procId, int lastStep) throws Exception Execute the procedure up to "lastStep" and then the ProcedureExecutor is restarted and an abort() is injected. If the procedure implement abort() this should result in rollback being triggered. At the end of this call the procedure should be finished and rolledback. This method assert on the procedure being terminated with an AbortException.- Throws:
Exception
-
testRestartWithAbort
public static void testRestartWithAbort(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv> procExec, long procId) throws Exception Restart the ProcedureExecutor and inject an abort to the specified procedure. If the procedure implement abort() this should result in rollback being triggered. At the end of this call the procedure should be finished and rolledback, if abort is implemnted- Throws:
Exception
-
tableExists
public static boolean tableExists(org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.TableName tableName) throws IOException - Throws:
IOException
-