Class TestZKProcedureControllers
java.lang.Object
org.apache.hadoop.hbase.procedure.TestZKProcedureControllers
Test zookeeper-based, procedure controllers
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate class
Specify how the controllers that should be started (not spy/mockable) for the test. -
Field Summary
Modifier and TypeFieldDescriptionstatic final HBaseClassTestRule
private static final String
private static final String
private static final org.slf4j.Logger
private final byte[]
private static final org.mockito.verification.VerificationMode
private final TestZKProcedureControllers.StartControllers
Check for the possible race condition where a cohort member starts after the controller and therefore could miss a new operationprivate final TestZKProcedureControllers.StartControllers
private static final HBaseTestingUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
void
runEarlyPrepareNodes
(TestZKProcedureControllers.StartControllers controllers, String operationName, byte[] data, String... cohort) private void
runMockCommitWithOrchestratedControllers
(TestZKProcedureControllers.StartControllers controllers, String operationName, byte[] data, String... cohort) private org.apache.hadoop.hbase.procedure.ProcedureCoordinator
setupMockCoordinator
(String operationName, CountDownLatch prepared, CountDownLatch committed, ArrayList<byte[]> dataFromMembers) static void
void
Smaller test to just test the actuation on the cohort membervoid
void
void
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 operationprivate 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 nodeprivate void
verifyZooKeeperClean
(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
ProcedureCoordinator
that 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
-