kaisun2000 commented on issue #1300:
URL: https://github.com/apache/helix/issues/1300#issuecomment-694745984
/TestHelixAdminCli/CONTROLLER/LEADER
super cluster ideal state
{
"id" : "TestHelixAdminCli",
"simpleFields" : {
"IDEAL_STATE_MODE" : "AUTO_REBALANCE",
"NUM_PARTITIONS" : "1",
"REBALANCER_CLASS_NAME" :
"org.apache.helix.controller.rebalancer.DelayedAutoRebalancer",
"REBALANCE_MODE" : "FULL_AUTO",
"REBALANCE_STRATEGY" :
"org.apache.helix.controller.rebalancer.strategy.CrushEdRebalanceStrategy",
"REPLICAS" : "3",
"STATE_MODEL_DEF_REF" : "LeaderStandby"
},
"mapFields" : { },
"listFields" : {
"TestHelixAdminCli" : [ ]
}
}
```
public void testDeactivateCluster() throws Exception {
final int n = 6;
System.out.println("START " + clusterName + " at " + new
Date(System.currentTimeMillis()));
MockParticipantManager[] participants = new MockParticipantManager[n];
ClusterDistributedController[] controllers = new
ClusterDistributedController[2];
setupCluster(clusterName, grandClusterName, n, participants,
controllers);
String command =
"-zkSvr " + ZK_ADDR + " -activateCluster " + clusterName + " " +
grandClusterName + " true";
ClusterSetup.processCommandLineArgs(command.split("\\s+"));
Thread.sleep(500);
-----> is it the reason that before cluster fully up we de-active cluster?
// deactivate cluster
command = "-zkSvr " + ZK_ADDR + " -activateCluster " + clusterName + " "
+ grandClusterName
+ " false";
ClusterSetup.processCommandLineArgs(command.split("\\s+"));
BaseDataAccessor<ZNRecord> baseAccessor = new
ZkBaseDataAccessor<>(_gZkClient);
HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName,
baseAccessor);
final String path = accessor.keyBuilder().controllerLeader().getPath();
TestHelper.verify(() -> !_gZkClient.exists(path), 10000L); ----->
here, validate that leader path removed /TestHelixAdminCli/CONTROLLER/LEADER
Assert.assertFalse(_gZkClient.exists(path),
"leader should be gone after deactivate the cluster");
command = "-zkSvr " + ZK_ADDR + " -dropCluster " + clusterName;
try {
ClusterSetup.processCommandLineArgs(command.split("\\s+"));
Assert.fail("dropCluster should fail since there are still instances
running");
} catch (Exception e) {
// OK
}
for (MockParticipantManager participant : participants) {
participant.syncStop();
}
for (MockParticipantManager participant : participants) {
if (participant.isConnected()) {
Thread.sleep(SLEEP_DURATION);
}
}
command = "-zkSvr localhost:2183 -dropCluster " + clusterName;
ClusterSetup.processCommandLineArgs(command.split("\\s"));
-------> "There are still LEADER in the cluster, shut them down first." this
is the leader node /TestHelixAdminCli/CONTROLLER/LEADER
for (ClusterDistributedController controller : controllers) {
controller.syncStop();
}
for (ClusterDistributedController controller : controllers) {
if (controller.isConnected()) {
Thread.sleep(SLEEP_DURATION);
}
}
command = "-zkSvr localhost:2183 -dropCluster " + grandClusterName;
ClusterSetup.processCommandLineArgs(command.split("\\s+"));
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]