Class ProcedureTestingUtility

java.lang.Object
org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility

public final class ProcedureTestingUtility extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
    static class 
     
    static class 
     
    static class 
     
  • 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
    static void
    assertIsAbortException(org.apache.hadoop.hbase.procedure2.Procedure<?> result)
     
    static void
    assertIsIllegalArgumentException(org.apache.hadoop.hbase.procedure2.Procedure<?> result)
     
    static void
    assertIsTimeoutException(org.apache.hadoop.hbase.procedure2.Procedure<?> result)
     
    static Throwable
    assertProcFailed(org.apache.hadoop.hbase.procedure2.Procedure<?> result)
     
    static <TEnv> Throwable
    assertProcFailed(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, long procId)
     
    static void
    assertProcNotFailed(org.apache.hadoop.hbase.procedure2.Procedure<?> result)
     
    static <TEnv> void
    assertProcNotFailed(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, long procId)
     
    static <TEnv> void
    assertProcNotYetCompleted(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, long procId)
     
    private static <TEnv> void
    assertSingleExecutorForKillTests(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor)
     
    private static <TEnv> void
    createExecutorTesting(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor)
     
    static org.apache.hadoop.hbase.procedure2.store.ProcedureStore
    createStore(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path dir)
     
    static org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore
    createWalStore(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path dir)
     
    static Throwable
    getExceptionCause(org.apache.hadoop.hbase.procedure2.Procedure<?> procInfo)
     
    static void
    initAndStartWorkers(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<?> procExecutor, int numThreads, boolean abortOnCorruption)
     
    static void
    initAndStartWorkers(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<?> procExecutor, int numThreads, boolean abortOnCorruption, boolean startWorkers)
     
    static <TEnv> void
    restart(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor)
     
    static <TEnv> void
    restart(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean abort)
     
    static <TEnv> void
    restart(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean abort, boolean startWorkers)
     
    static <TEnv> void
    restart(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean avoidTestKillDuringRestart, boolean failOnCorrupted, Callable<Void> stopAction, Callable<Void> actionBeforeStartWorker, Callable<Void> startAction)
     
    static <TEnv> void
    restart(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean avoidTestKillDuringRestart, boolean failOnCorrupted, Callable<Void> stopAction, Callable<Void> actionBeforeStartWorker, Callable<Void> startAction, boolean abort, boolean startWorkers)
     
    static <TEnv> void
    setKillAndToggleBeforeStoreUpdate(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean value)
     
    static <TEnv> void
    setKillAndToggleBeforeStoreUpdateInRollback(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean value)
     
    static <TEnv> void
    setKillBeforeStoreUpdate(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean value)
     
    static <TEnv> void
    setKillBeforeStoreUpdateInRollback(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean value)
     
    static <TEnv> void
    setKillIfHasParent(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean value)
     
    static <TEnv> void
    setKillIfSuspended(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean value)
     
    static <TEnv> void
    setToggleKillBeforeStoreUpdate(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean value)
     
    static <TEnv> void
    setToggleKillBeforeStoreUpdateInRollback(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean value)
     
    static void
    storeRestart(org.apache.hadoop.hbase.procedure2.store.ProcedureStore procStore, boolean abort, org.apache.hadoop.hbase.procedure2.store.ProcedureStore.ProcedureLoader loader)
     
    static void
    storeRestart(org.apache.hadoop.hbase.procedure2.store.ProcedureStore procStore, org.apache.hadoop.hbase.procedure2.store.ProcedureStore.ProcedureLoader loader)
     
    storeRestartAndAssert(org.apache.hadoop.hbase.procedure2.store.ProcedureStore procStore, long maxProcId, long runnableCount, int completedCount, int corruptedCount)
     
    static <TEnv> long
    submitAndWait(org.apache.hadoop.conf.Configuration conf, TEnv env, org.apache.hadoop.hbase.procedure2.Procedure<TEnv> proc)
     
    static <TEnv> long
    submitAndWait(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, org.apache.hadoop.hbase.procedure2.Procedure proc)
     
    static <TEnv> long
    submitAndWait(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, org.apache.hadoop.hbase.procedure2.Procedure proc, long nonceGroup, long nonce)
     
    static <TEnv> long
    submitProcedure(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, org.apache.hadoop.hbase.procedure2.Procedure proc, long nonceGroup, long nonce)
     
    static <TEnv> void
    testRecoveryAndDoubleExecution(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExec, long procId)
    Run through all procedure flow states TWICE while also restarting procedure executor at each step; i.e force a reread of procedure store.
    static <TEnv> void
    testRecoveryAndDoubleExecution(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExec, long procId, boolean expectFailure)
     
    static <TEnv> void
    testRecoveryAndDoubleExecution(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExec, long procId, boolean expectFailure, Runnable customRestart)
     
    static <TEnv> void
    toggleKillAfterStoreUpdate(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor)
     
    static <TEnv> void
    toggleKillBeforeStoreUpdate(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor)
     
    static <TEnv> void
    toggleKillBeforeStoreUpdateInRollback(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor)
     
    static <TEnv> void
    waitAllProcedures(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor)
     
    static <TEnv> void
    waitNoProcedureRunning(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor)
     
    static <TEnv> void
    waitProcedure(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, long procId)
     
    static <TEnv> void
    waitProcedure(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, org.apache.hadoop.hbase.procedure2.Procedure proc)
     
    static <TEnv> void
    waitProcedures(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, long... procIds)
     

    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

    • createStore

      public static org.apache.hadoop.hbase.procedure2.store.ProcedureStore createStore(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path dir) throws IOException
      Throws:
      IOException
    • createWalStore

      public static org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore createWalStore(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path dir) throws IOException
      Throws:
      IOException
    • restart

      public static <TEnv> void restart(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean abort, boolean startWorkers) throws Exception
      Throws:
      Exception
    • restart

      public static <TEnv> void restart(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean abort) throws Exception
      Throws:
      Exception
    • restart

      public static <TEnv> void restart(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor) throws Exception
      Throws:
      Exception
    • initAndStartWorkers

      public static void initAndStartWorkers(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<?> procExecutor, int numThreads, boolean abortOnCorruption) throws IOException
      Throws:
      IOException
    • initAndStartWorkers

      public static void initAndStartWorkers(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<?> procExecutor, int numThreads, boolean abortOnCorruption, boolean startWorkers) throws IOException
      Throws:
      IOException
    • restart

      public static <TEnv> void restart(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean avoidTestKillDuringRestart, boolean failOnCorrupted, Callable<Void> stopAction, Callable<Void> actionBeforeStartWorker, Callable<Void> startAction) throws Exception
      Throws:
      Exception
    • restart

      public static <TEnv> void restart(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean avoidTestKillDuringRestart, boolean failOnCorrupted, Callable<Void> stopAction, Callable<Void> actionBeforeStartWorker, Callable<Void> startAction, boolean abort, boolean startWorkers) throws Exception
      Throws:
      Exception
    • storeRestart

      public static void storeRestart(org.apache.hadoop.hbase.procedure2.store.ProcedureStore procStore, org.apache.hadoop.hbase.procedure2.store.ProcedureStore.ProcedureLoader loader) throws Exception
      Throws:
      Exception
    • storeRestart

      public static void storeRestart(org.apache.hadoop.hbase.procedure2.store.ProcedureStore procStore, boolean abort, org.apache.hadoop.hbase.procedure2.store.ProcedureStore.ProcedureLoader loader) throws Exception
      Throws:
      Exception
    • storeRestartAndAssert

      public static ProcedureTestingUtility.LoadCounter storeRestartAndAssert(org.apache.hadoop.hbase.procedure2.store.ProcedureStore procStore, long maxProcId, long runnableCount, int completedCount, int corruptedCount) throws Exception
      Throws:
      Exception
    • createExecutorTesting

      private static <TEnv> void createExecutorTesting(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor)
    • setKillIfHasParent

      public static <TEnv> void setKillIfHasParent(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean value)
    • setKillIfSuspended

      public static <TEnv> void setKillIfSuspended(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean value)
    • setKillBeforeStoreUpdate

      public static <TEnv> void setKillBeforeStoreUpdate(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean value)
    • setKillBeforeStoreUpdateInRollback

      public static <TEnv> void setKillBeforeStoreUpdateInRollback(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean value)
    • setToggleKillBeforeStoreUpdate

      public static <TEnv> void setToggleKillBeforeStoreUpdate(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean value)
    • setToggleKillBeforeStoreUpdateInRollback

      public static <TEnv> void setToggleKillBeforeStoreUpdateInRollback(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean value)
    • toggleKillBeforeStoreUpdate

      public static <TEnv> void toggleKillBeforeStoreUpdate(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor)
    • toggleKillBeforeStoreUpdateInRollback

      public static <TEnv> void toggleKillBeforeStoreUpdateInRollback(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor)
    • toggleKillAfterStoreUpdate

      public static <TEnv> void toggleKillAfterStoreUpdate(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor)
    • setKillAndToggleBeforeStoreUpdate

      public static <TEnv> void setKillAndToggleBeforeStoreUpdate(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean value)
    • setKillAndToggleBeforeStoreUpdateInRollback

      public static <TEnv> void setKillAndToggleBeforeStoreUpdateInRollback(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, boolean value)
    • assertSingleExecutorForKillTests

      private static <TEnv> void assertSingleExecutorForKillTests(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor)
    • submitAndWait

      public static <TEnv> long submitAndWait(org.apache.hadoop.conf.Configuration conf, TEnv env, org.apache.hadoop.hbase.procedure2.Procedure<TEnv> proc) throws IOException
      Throws:
      IOException
    • submitAndWait

      public static <TEnv> long submitAndWait(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, org.apache.hadoop.hbase.procedure2.Procedure proc)
    • submitAndWait

      public static <TEnv> long submitAndWait(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, org.apache.hadoop.hbase.procedure2.Procedure proc, long nonceGroup, long nonce)
    • submitProcedure

      public static <TEnv> long submitProcedure(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, org.apache.hadoop.hbase.procedure2.Procedure proc, long nonceGroup, long nonce)
    • waitProcedure

      public static <TEnv> void waitProcedure(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, org.apache.hadoop.hbase.procedure2.Procedure proc)
    • waitProcedure

      public static <TEnv> void waitProcedure(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, long procId)
    • waitProcedures

      public static <TEnv> void waitProcedures(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, long... procIds)
    • waitAllProcedures

      public static <TEnv> void waitAllProcedures(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor)
    • waitNoProcedureRunning

      public static <TEnv> void waitNoProcedureRunning(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor)
    • assertProcNotYetCompleted

      public static <TEnv> void assertProcNotYetCompleted(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, long procId)
    • assertProcNotFailed

      public static <TEnv> void assertProcNotFailed(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, long procId)
    • assertProcNotFailed

      public static void assertProcNotFailed(org.apache.hadoop.hbase.procedure2.Procedure<?> result)
    • assertProcFailed

      public static <TEnv> Throwable assertProcFailed(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExecutor, long procId)
    • assertProcFailed

      public static Throwable assertProcFailed(org.apache.hadoop.hbase.procedure2.Procedure<?> result)
    • assertIsAbortException

      public static void assertIsAbortException(org.apache.hadoop.hbase.procedure2.Procedure<?> result)
    • assertIsTimeoutException

      public static void assertIsTimeoutException(org.apache.hadoop.hbase.procedure2.Procedure<?> result)
    • assertIsIllegalArgumentException

      public static void assertIsIllegalArgumentException(org.apache.hadoop.hbase.procedure2.Procedure<?> result)
    • getExceptionCause

      public static Throwable getExceptionCause(org.apache.hadoop.hbase.procedure2.Procedure<?> procInfo)
    • testRecoveryAndDoubleExecution

      public static <TEnv> void testRecoveryAndDoubleExecution(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExec, long procId) 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.

      Throws:
      Exception
    • testRecoveryAndDoubleExecution

      public static <TEnv> void testRecoveryAndDoubleExecution(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExec, long procId, boolean expectFailure) throws Exception
      Throws:
      Exception
    • testRecoveryAndDoubleExecution

      public static <TEnv> void testRecoveryAndDoubleExecution(org.apache.hadoop.hbase.procedure2.ProcedureExecutor<TEnv> procExec, long procId, boolean expectFailure, Runnable customRestart) throws Exception
      Throws:
      Exception