Class TestZKProcedure
java.lang.Object
org.apache.hadoop.hbase.procedure.TestZKProcedure
Cluster-wide testing of a distributed three-phase commit using a 'real' zookeeper cluster
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HBaseClassTestRuleprivate static final Stringprivate static final byte[]private static final longprivate static final org.slf4j.Loggerprivate static final org.mockito.verification.VerificationModeprivate static final Stringprivate static final intprivate static final longprivate static HBaseTestingUtilprivate static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidprivate voidcloseAll(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.ZKWatcherprivate voidstatic voidvoidvoidTest a distributed commit with multiple cohort members, where one of the cohort members has a timeout exception during the prepare stage.voidvoidprivate voidverifyCohortSuccessful(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 voidwaitAndVerifyProc(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 mocksprivate voidwaitAndVerifySubproc(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
-
Field Details
-
CLASS_RULE
-
LOG
-
UTIL
-
COORDINATOR_NODE_NAME
- See Also:
-
KEEP_ALIVE
- See Also:
-
POOL_SIZE
- See Also:
-
TIMEOUT
- See Also:
-
WAKE_FREQUENCY
- See Also:
-
opName
- See Also:
-
data
-
once
-
-
Constructor Details
-
TestZKProcedure
public TestZKProcedure()
-
-
Method Details
-
setupTest
- Throws:
Exception
-
cleanupTest
- Throws:
Exception
-
newZooKeeperWatcher
- Throws:
IOException
-
testEmptyMemberSet
- Throws:
Exception
-
testSingleMember
- Throws:
Exception
-
testMultipleMembers
- Throws:
Exception
-
runCommit
- 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- theProcedureto executeprepare- the mock preparecommit- the mock commitcleanup- the mock cleanupfinish- the mock finishopHasError- 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- theSubprocedureto useprepare- the mock preparecommit- the mock commitcleanup- the mock cleanupfinish- the mock finishopHasError- 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
-