Class MasterProcedureTestingUtility

java.lang.Object
org.apache.hadoop.hbase.master.procedure.MasterProcedureTestingUtility

@Private public class MasterProcedureTestingUtility extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
    static interface 
    Hook which will be executed on each step
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final org.slf4j.Logger
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static int
    countMetaRegions(org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.TableName tableName)
     
    static org.apache.hadoop.hbase.client.TableDescriptor
    createHTD(org.apache.hadoop.hbase.TableName tableName, String... family)
     
    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
     
    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(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.master.HMaster oldMaster)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
  • Constructor Details

  • 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

      public static void masterFailover(HBaseTestingUtil testUtil) throws Exception
      Throws:
      Exception
    • waitBackupMaster

      public static void waitBackupMaster(HBaseTestingUtil testUtil, org.apache.hadoop.hbase.master.HMaster oldMaster) throws Exception
      Throws:
      Exception
    • createHTD

      public static org.apache.hadoop.hbase.client.TableDescriptor createHTD(org.apache.hadoop.hbase.TableName tableName, String... family)
    • 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

      public static long generateNonceGroup(org.apache.hadoop.hbase.master.HMaster master)
    • generateNonce

      public static long generateNonce(org.apache.hadoop.hbase.master.HMaster master)
    • 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

      1. Execute step N - kill the executor before store update
      2. Restart executor/store
      3. 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

      1. Execute step N - kill the executor before store update
      2. Restart executor/store
      3. Executes hook for each step twice
      4. 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.

      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) 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