public class TestZKProcedureControllers extends Object
Modifier and Type | Class and Description |
---|---|
private class |
TestZKProcedureControllers.StartControllers
Specify how the controllers that should be started (not spy/mockable) for the test.
|
Modifier and Type | Field and Description |
---|---|
static HBaseClassTestRule |
CLASS_RULE |
private static String |
COHORT_NODE_NAME |
private static String |
CONTROLLER_NODE_NAME |
private static org.slf4j.Logger |
LOG |
private byte[] |
memberData |
private static org.mockito.verification.VerificationMode |
once |
private TestZKProcedureControllers.StartControllers |
startCohortFirst
Check for the possible race condition where a cohort member starts after the controller and
therefore could miss a new operation
|
private TestZKProcedureControllers.StartControllers |
startCoordinatorFirst |
private static HBaseTestingUtility |
UTIL |
Constructor and Description |
---|
TestZKProcedureControllers() |
Modifier and Type | Method and Description |
---|---|
static void |
cleanupTest() |
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 |
setupTest() |
void |
testSimpleZKCohortMemberController()
Smaller test to just test the actuation on the cohort member
|
void |
testZKCoordinatorControllerMultipleCohort() |
void |
testZKCoordinatorControllerWithNoCohort() |
void |
testZKCoordinatorControllerWithSingleMemberCohort() |
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
|
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
|
private 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
|
public static final HBaseClassTestRule CLASS_RULE
private static final org.slf4j.Logger LOG
private static final HBaseTestingUtility UTIL
private static final String COHORT_NODE_NAME
private static final String CONTROLLER_NODE_NAME
private static final org.mockito.verification.VerificationMode once
private final byte[] memberData
private final TestZKProcedureControllers.StartControllers startCoordinatorFirst
private final TestZKProcedureControllers.StartControllers startCohortFirst
public TestZKProcedureControllers()
public static void cleanupTest() throws Exception
Exception
public void testSimpleZKCohortMemberController() throws Exception
Exception
- on failurepublic void testZKCoordinatorControllerWithNoCohort() throws Exception
Exception
public void testZKCoordinatorControllerWithSingleMemberCohort() throws Exception
Exception
public void testZKCoordinatorControllerMultipleCohort() throws Exception
Exception
private void runMockCommitWithOrchestratedControllers(TestZKProcedureControllers.StartControllers controllers, String operationName, byte[] data, String... cohort) throws Exception
Exception
public void runEarlyPrepareNodes(TestZKProcedureControllers.StartControllers controllers, String operationName, byte[] data, String... cohort) throws Exception
Exception
private org.apache.hadoop.hbase.procedure.ProcedureCoordinator setupMockCoordinator(String operationName, CountDownLatch prepared, CountDownLatch committed, ArrayList<byte[]> dataFromMembers)
dataFromMembers
- ProcedureCoordinator
that just counts down the
prepared and committed latch for called to the respective methodprivate void verifyZooKeeperClean(String operationName, org.apache.hadoop.hbase.zookeeper.ZKWatcher watcher, org.apache.hadoop.hbase.procedure.ZKProcedureUtil controller) throws Exception
Exception
private void verifyCohort(org.apache.hadoop.hbase.procedure.ProcedureMember member, int cohortSize, String operationName, byte[] data)
private void verifyCoordinator(String operationName, org.apache.hadoop.hbase.procedure.ProcedureCoordinator coordinator, List<String> expected)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.