use of org.apache.helix.integration.manager.MockParticipantManager in project helix by apache.
the class TestCrushAutoRebalance method testLackEnoughRacks.
@Test(dependsOnMethods = { "testLackEnoughLiveRacks" })
public void testLackEnoughRacks() throws Exception {
System.out.println("TestLackEnoughInstances ");
enablePersistBestPossibleAssignment(_gZkClient, CLUSTER_NAME, true);
// shutdown participants within one zone
String zone = _nodeToZoneMap.values().iterator().next();
for (int i = 0; i < _participants.size(); i++) {
MockParticipantManager p = _participants.get(i);
if (_nodeToZoneMap.get(p.getInstanceName()).equals(zone)) {
p.syncStop();
_setupTool.getClusterManagementTool().enableInstance(CLUSTER_NAME, p.getInstanceName(), false);
Thread.sleep(50);
_setupTool.dropInstanceFromCluster(CLUSTER_NAME, p.getInstanceName());
}
}
int i = 0;
for (String stateModel : _testModels) {
String db = "Test-DB-CrushRebalanceStrategy-" + i++;
_setupTool.addResourceToCluster(CLUSTER_NAME, db, _PARTITIONS, stateModel, RebalanceMode.FULL_AUTO + "", CrushRebalanceStrategy.class.getName());
_setupTool.rebalanceStorageCluster(CLUSTER_NAME, db, _replica);
_allDBs.add(db);
}
Thread.sleep(300);
HelixClusterVerifier _clusterVerifier = new BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkAddr(ZK_ADDR).setResources(_allDBs).build();
Assert.assertTrue(_clusterVerifier.verify());
for (String db : _allDBs) {
IdealState is = _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, db);
ExternalView ev = _setupTool.getClusterManagementTool().getResourceExternalView(CLUSTER_NAME, db);
validateZoneAndTagIsolation(is, ev, 2);
}
}
use of org.apache.helix.integration.manager.MockParticipantManager in project helix by apache.
the class TestDelayedAutoRebalance method beforeClass.
@BeforeClass
public void beforeClass() throws Exception {
System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis()));
String namespace = "/" + CLUSTER_NAME;
if (_gZkClient.exists(namespace)) {
_gZkClient.deleteRecursively(namespace);
}
_setupTool = new ClusterSetup(_gZkClient);
_setupTool.addCluster(CLUSTER_NAME, true);
for (int i = 0; i < NUM_NODE; i++) {
String storageNodeName = PARTICIPANT_PREFIX + "_" + (START_PORT + i);
_setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
// start dummy participants
MockParticipantManager participant = new MockParticipantManager(ZK_ADDR, CLUSTER_NAME, storageNodeName);
participant.syncStart();
_participants.add(participant);
}
// start controller
String controllerName = CONTROLLER_PREFIX + "_0";
_controller = new ClusterControllerManager(ZK_ADDR, CLUSTER_NAME, controllerName);
_controller.syncStart();
_clusterVerifier = new BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkAddr(ZK_ADDR).build();
enablePersistBestPossibleAssignment(_gZkClient, CLUSTER_NAME, true);
}
use of org.apache.helix.integration.manager.MockParticipantManager in project helix by apache.
the class TestDelayedAutoRebalance method afterClass.
@AfterClass
public void afterClass() throws Exception {
/**
* shutdown order: 1) disconnect the controller 2) disconnect participants
*/
_controller.syncStop();
for (MockParticipantManager participant : _participants) {
participant.syncStop();
}
_setupTool.deleteCluster(CLUSTER_NAME);
System.out.println("END " + CLASS_NAME + " at " + new Date(System.currentTimeMillis()));
}
use of org.apache.helix.integration.manager.MockParticipantManager in project helix by apache.
the class TestDelayedAutoRebalanceWithDisabledInstance method beforeTest.
@BeforeMethod
public void beforeTest() {
// restart any participant that has been disconnected from last test.
for (int i = 0; i < _participants.size(); i++) {
if (!_participants.get(i).isConnected()) {
_participants.set(i, new MockParticipantManager(ZK_ADDR, CLUSTER_NAME, _participants.get(i).getInstanceName()));
_participants.get(i).syncStart();
}
enableInstance(_participants.get(i).getInstanceName(), true);
}
}
use of org.apache.helix.integration.manager.MockParticipantManager in project helix by apache.
the class TestDelayedAutoRebalanceWithRackaware method beforeClass.
@BeforeClass
public void beforeClass() throws Exception {
System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis()));
String namespace = "/" + CLUSTER_NAME;
if (_gZkClient.exists(namespace)) {
_gZkClient.deleteRecursively(namespace);
}
_setupTool = new ClusterSetup(_gZkClient);
_setupTool.addCluster(CLUSTER_NAME, true);
for (int i = 0; i < NUM_NODE; i++) {
String storageNodeName = PARTICIPANT_PREFIX + "_" + (START_PORT + i);
_setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
String zone = "zone-" + i % 3;
_setupTool.getClusterManagementTool().setInstanceZoneId(CLUSTER_NAME, storageNodeName, zone);
// start dummy participants
MockParticipantManager participant = new MockParticipantManager(ZK_ADDR, CLUSTER_NAME, storageNodeName);
participant.syncStart();
_participants.add(participant);
}
enableTopologyAwareRebalance(_gZkClient, CLUSTER_NAME, true);
enablePersistBestPossibleAssignment(_gZkClient, CLUSTER_NAME, true);
// start controller
String controllerName = CONTROLLER_PREFIX + "_0";
_controller = new ClusterControllerManager(ZK_ADDR, CLUSTER_NAME, controllerName);
_controller.syncStart();
_clusterVerifier = new BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkAddr(ZK_ADDR).build();
}
Aggregations