Class TestZKProcedure

java.lang.Object
org.apache.hadoop.hbase.procedure.TestZKProcedure

public class TestZKProcedure extends Object
Cluster-wide testing of a distributed three-phase commit using a 'real' zookeeper cluster
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final HBaseClassTestRule
     
    private static final String
     
    private static final byte[]
     
    private static final long
     
    private static final org.slf4j.Logger
     
    private static final org.mockito.verification.VerificationMode
     
    private static final String
     
    private static final int
     
    private static final long
     
    private static HBaseTestingUtility
     
    private static final long
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
     
    private void
    closeAll(org.apache.hadoop.hbase.procedure.ProcedureCoordinator coordinator, org.apache.hadoop.hbase.procedure.ZKProcedureCoordinator coordinatorController, List<org.apache.hadoop.hbase.util.Pair<org.apache.hadoop.hbase.procedure.ProcedureMember,org.apache.hadoop.hbase.procedure.ZKProcedureMemberRpcs>> cohort)
     
    private static org.apache.hadoop.hbase.zookeeper.ZKWatcher
     
    private void
    runCommit(String... members)
     
    static void
     
    void
     
    void
    Test a distributed commit with multiple cohort members, where one of the cohort members has a timeout exception during the prepare stage.
    void
     
    void
     
    private void
    verifyCohortSuccessful(List<String> cohortNames, org.apache.hadoop.hbase.procedure.SubprocedureFactory subprocFactory, Iterable<org.apache.hadoop.hbase.procedure.Subprocedure> cohortTasks, org.mockito.verification.VerificationMode prepare, org.mockito.verification.VerificationMode commit, org.mockito.verification.VerificationMode cleanup, org.mockito.verification.VerificationMode finish, boolean opHasError)
     
    private void
    waitAndVerifyProc(org.apache.hadoop.hbase.procedure.Procedure proc, org.mockito.verification.VerificationMode prepare, org.mockito.verification.VerificationMode commit, org.mockito.verification.VerificationMode cleanup, org.mockito.verification.VerificationMode finish, boolean opHasError)
    Wait for the coordinator task to complete, and verify all the mocks
    private void
    waitAndVerifySubproc(org.apache.hadoop.hbase.procedure.Subprocedure op, org.mockito.verification.VerificationMode prepare, org.mockito.verification.VerificationMode commit, org.mockito.verification.VerificationMode cleanup, org.mockito.verification.VerificationMode finish, boolean opHasError)
    Wait for the coordinator task to complete, and verify all the mocks

    Methods inherited from class java.lang.Object

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

  • Constructor Details

  • Method Details

    • setupTest

      public static void setupTest() throws Exception
      Throws:
      Exception
    • cleanupTest

      public static void cleanupTest() throws Exception
      Throws:
      Exception
    • newZooKeeperWatcher

      private static org.apache.hadoop.hbase.zookeeper.ZKWatcher newZooKeeperWatcher() throws IOException
      Throws:
      IOException
    • testEmptyMemberSet

      public void testEmptyMemberSet() throws Exception
      Throws:
      Exception
    • testSingleMember

      public void testSingleMember() throws Exception
      Throws:
      Exception
    • testMultipleMembers

      public void testMultipleMembers() throws Exception
      Throws:
      Exception
    • runCommit

      private void runCommit(String... members) throws Exception
      Throws:
      Exception
    • testMultiCohortWithMemberTimeoutDuringPrepare

      Test a distributed commit with multiple cohort members, where one of the cohort members has a timeout exception during the prepare stage.
      Throws:
      Exception
    • waitAndVerifyProc

      private void waitAndVerifyProc(org.apache.hadoop.hbase.procedure.Procedure proc, org.mockito.verification.VerificationMode prepare, org.mockito.verification.VerificationMode commit, org.mockito.verification.VerificationMode cleanup, org.mockito.verification.VerificationMode finish, boolean opHasError) throws Exception
      Wait for the coordinator task to complete, and verify all the mocks
      Parameters:
      proc - the Procedure to execute
      prepare - the mock prepare
      commit - the mock commit
      cleanup - the mock cleanup
      finish - the mock finish
      opHasError - the operation error state
      Throws:
      Exception - on unexpected failure
    • waitAndVerifySubproc

      private void waitAndVerifySubproc(org.apache.hadoop.hbase.procedure.Subprocedure op, org.mockito.verification.VerificationMode prepare, org.mockito.verification.VerificationMode commit, org.mockito.verification.VerificationMode cleanup, org.mockito.verification.VerificationMode finish, boolean opHasError) throws Exception
      Wait for the coordinator task to complete, and verify all the mocks
      Parameters:
      op - the Subprocedure to use
      prepare - the mock prepare
      commit - the mock commit
      cleanup - the mock cleanup
      finish - the mock finish
      opHasError - the operation error state
      Throws:
      Exception - on unexpected failure
    • verifyCohortSuccessful

      private void verifyCohortSuccessful(List<String> cohortNames, org.apache.hadoop.hbase.procedure.SubprocedureFactory subprocFactory, Iterable<org.apache.hadoop.hbase.procedure.Subprocedure> cohortTasks, org.mockito.verification.VerificationMode prepare, org.mockito.verification.VerificationMode commit, org.mockito.verification.VerificationMode cleanup, org.mockito.verification.VerificationMode finish, boolean opHasError) throws Exception
      Throws:
      Exception
    • closeAll

      private void closeAll(org.apache.hadoop.hbase.procedure.ProcedureCoordinator coordinator, org.apache.hadoop.hbase.procedure.ZKProcedureCoordinator coordinatorController, List<org.apache.hadoop.hbase.util.Pair<org.apache.hadoop.hbase.procedure.ProcedureMember,org.apache.hadoop.hbase.procedure.ZKProcedureMemberRpcs>> cohort) throws IOException
      Throws:
      IOException