Class TestProcedureMember

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

public class TestProcedureMember extends Object
Test the procedure member, and it's error handling mechanisms.
  • Field Details

  • Constructor Details

  • Method Details

    • resetTest

      public void resetTest() throws IOException
      Reset all the mock objects
      Throws:
      IOException
    • buildCohortMember

      private org.apache.hadoop.hbase.procedure.ProcedureMember buildCohortMember()
      Build a member using the class level mocks
      Returns:
      member to use for tests
    • buildCohortMemberPair

      private void buildCohortMemberPair() throws IOException
      Setup a procedure member that returns the spied-upon Subprocedure.
      Throws:
      IOException
    • addCommitAnswer

      private void addCommitAnswer() throws IOException
      Add a 'in barrier phase' response to the mock controller when it gets a acquired notification
      Throws:
      IOException
    • testSimpleRun

      public void testSimpleRun() throws Exception
      Test the normal sub procedure execution case.
      Throws:
      Exception
    • testMemberPrepareException

      public void testMemberPrepareException() throws Exception
      Make sure we call cleanup etc, when we have an exception during Subprocedure.acquireBarrier().
      Throws:
      Exception
    • testSendMemberAcquiredCommsFailure

      Make sure we call cleanup etc, when we have an exception during prepare.
      Throws:
      Exception
    • testCoordinatorAbort

      public void testCoordinatorAbort() throws Exception
      Fail correctly if coordinator aborts the procedure. The subprocedure will not interrupt a running Subprocedure.acquireBarrier() -- prepare needs to finish first, and the the abort is checked. Thus, the Subprocedure.acquireBarrier() should succeed but later get rolled back via Subprocedure.cleanup(java.lang.Exception).
      Throws:
      Exception
    • testMemberCommitException

      public void testMemberCommitException() throws Exception
      Handle failures if a member's commit phase fails.

      NOTE: This is the core difference that makes this different from traditional 2PC. In true 2PC the transaction is committed just before the coordinator sends commit messages to the member. Members are then responsible for reading its TX log. This implementation actually rolls back, and thus breaks the normal TX guarantees.

      Throws:
      Exception
    • testMemberCommitCommsFailure

      Handle Failures if a member's commit phase succeeds but notification to coordinator fails

      NOTE: This is the core difference that makes this different from traditional 2PC. In true 2PC the transaction is committed just before the coordinator sends commit messages to the member. Members are then responsible for reading its TX log. This implementation actually rolls back, and thus breaks the normal TX guarantees.

      Throws:
      Exception
    • testPropagateConnectionErrorBackToManager

      Fail correctly on getting an external error while waiting for the prepared latch
      Throws:
      Exception - on failure
    • testNoTaskToBeRunFromRequest

      Test that the cohort member correctly doesn't attempt to start a task when the builder cannot correctly build a new task for the requested operation
      Throws:
      Exception - on failure