Class TestZKProcedureControllers
java.lang.Object
org.apache.hadoop.hbase.procedure.TestZKProcedureControllers
Test zookeeper-based, procedure controllers
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classSpecify how the controllers that should be started (not spy/mockable) for the test. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HBaseClassTestRuleprivate static final Stringprivate static final Stringprivate static final org.slf4j.Loggerprivate final byte[]private static final org.mockito.verification.VerificationModeprivate final TestZKProcedureControllers.StartControllersCheck for the possible race condition where a cohort member starts after the controller and therefore could miss a new operationprivate final TestZKProcedureControllers.StartControllersprivate static final HBaseTestingUtil -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidvoidrunEarlyPrepareNodes(TestZKProcedureControllers.StartControllers controllers, String operationName, byte[] data, String... cohort) private voidrunMockCommitWithOrchestratedControllers(TestZKProcedureControllers.StartControllers controllers, String operationName, byte[] data, String... cohort) private org.apache.hadoop.hbase.procedure.ProcedureCoordinatorsetupMockCoordinator(String operationName, CountDownLatch prepared, CountDownLatch committed, ArrayList<byte[]> dataFromMembers) static voidvoidSmaller test to just test the actuation on the cohort membervoidvoidvoidprivate voidverifyCohort(org.apache.hadoop.hbase.procedure.ProcedureMember member, int cohortSize, String operationName, byte[] data) Verify the cohort controller got called once per expected node to start the operationprivate voidverifyCoordinator(String operationName, org.apache.hadoop.hbase.procedure.ProcedureCoordinator coordinator, List<String> expected) Verify that the coordinator only got called once for each expected nodeprivate voidverifyZooKeeperClean(String operationName, org.apache.hadoop.hbase.zookeeper.ZKWatcher watcher, org.apache.hadoop.hbase.procedure.ZKProcedureUtil controller) Verify that the prepare, commit and abort nodes for the operation are removed from zookeeper
-
Field Details
-
CLASS_RULE
-
LOG
-
UTIL
-
COHORT_NODE_NAME
- See Also:
-
CONTROLLER_NODE_NAME
- See Also:
-
once
-
memberData
-
startCoordinatorFirst
-
startCohortFirst
Check for the possible race condition where a cohort member starts after the controller and therefore could miss a new operation
-
-
Constructor Details
-
TestZKProcedureControllers
public TestZKProcedureControllers()
-
-
Method Details
-
setupTest
- Throws:
Exception
-
cleanupTest
- Throws:
Exception
-
testSimpleZKCohortMemberController
Smaller test to just test the actuation on the cohort member- Throws:
Exception- on failure
-
testZKCoordinatorControllerWithNoCohort
- Throws:
Exception
-
testZKCoordinatorControllerWithSingleMemberCohort
- Throws:
Exception
-
testZKCoordinatorControllerMultipleCohort
- Throws:
Exception
-
runMockCommitWithOrchestratedControllers
private void runMockCommitWithOrchestratedControllers(TestZKProcedureControllers.StartControllers controllers, String operationName, byte[] data, String... cohort) throws Exception - Throws:
Exception
-
runEarlyPrepareNodes
public void runEarlyPrepareNodes(TestZKProcedureControllers.StartControllers controllers, String operationName, byte[] data, String... cohort) throws Exception - Throws:
Exception
-
setupMockCoordinator
private org.apache.hadoop.hbase.procedure.ProcedureCoordinator setupMockCoordinator(String operationName, CountDownLatch prepared, CountDownLatch committed, ArrayList<byte[]> dataFromMembers) - Returns:
- a mock
ProcedureCoordinatorthat just counts down the prepared and committed latch for called to the respective method
-
verifyZooKeeperClean
private void verifyZooKeeperClean(String operationName, org.apache.hadoop.hbase.zookeeper.ZKWatcher watcher, org.apache.hadoop.hbase.procedure.ZKProcedureUtil controller) throws Exception Verify that the prepare, commit and abort nodes for the operation are removed from zookeeper- Throws:
Exception
-
verifyCohort
private void verifyCohort(org.apache.hadoop.hbase.procedure.ProcedureMember member, int cohortSize, String operationName, byte[] data) Verify the cohort controller got called once per expected node to start the operation -
verifyCoordinator
private void verifyCoordinator(String operationName, org.apache.hadoop.hbase.procedure.ProcedureCoordinator coordinator, List<String> expected) Verify that the coordinator only got called once for each expected node
-