use of org.apache.helix.ConfigAccessor in project helix by apache.
the class TestJobFailureTaskNotStarted method beforeClass.
@BeforeClass
public void beforeClass() throws Exception {
_participants = new MockParticipantManager[_numNodes];
_numDbs = 1;
_numNodes = 2;
_numParitions = 2;
_numReplicas = 1;
String namespace = "/" + CLUSTER_NAME;
if (_gZkClient.exists(namespace)) {
_gZkClient.deleteRecursively(namespace);
}
_setupTool = new ClusterSetup(ZK_ADDR);
_setupTool.addCluster(CLUSTER_NAME, true);
setupParticipants();
setupDBs();
startParticipantsWithStuckTaskStateModelFactory();
createManagers();
_controller = new ClusterControllerManager(ZK_ADDR, CLUSTER_NAME, CONTROLLER_PREFIX);
_controller.syncStart();
// Enable cancellation
ConfigAccessor _configAccessor = new ConfigAccessor(_gZkClient);
ClusterConfig clusterConfig = _configAccessor.getClusterConfig(CLUSTER_NAME);
clusterConfig.stateTransitionCancelEnabled(true);
_configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig);
}
use of org.apache.helix.ConfigAccessor in project helix by apache.
the class StrictMatchExternalViewVerifier method verifyExternalView.
private boolean verifyExternalView(ClusterDataCache dataCache, ExternalView externalView, IdealState idealState) {
Map<String, Map<String, String>> mappingInExtview = externalView.getRecord().getMapFields();
Map<String, Map<String, String>> idealPartitionState;
switch(idealState.getRebalanceMode()) {
case FULL_AUTO:
ClusterConfig clusterConfig = new ConfigAccessor(_zkClient).getClusterConfig(dataCache.getClusterName());
if (!clusterConfig.isPersistBestPossibleAssignment() && !clusterConfig.isPersistIntermediateAssignment()) {
throw new HelixException(String.format("Full-Auto IdealState verifier requires " + "ClusterConfig.PERSIST_BEST_POSSIBLE_ASSIGNMENT or ClusterConfig.PERSIST_INTERMEDIATE_ASSIGNMENT " + "is enabled."));
}
for (String partition : idealState.getPartitionSet()) {
if (idealState.getPreferenceList(partition) == null || idealState.getPreferenceList(partition).isEmpty()) {
return false;
}
}
idealPartitionState = computeIdealPartitionState(dataCache, idealState);
break;
case SEMI_AUTO:
case USER_DEFINED:
idealPartitionState = computeIdealPartitionState(dataCache, idealState);
break;
case CUSTOMIZED:
idealPartitionState = idealState.getRecord().getMapFields();
break;
case TASK:
// ignore jobs
default:
return true;
}
return mappingInExtview.equals(idealPartitionState);
}
use of org.apache.helix.ConfigAccessor in project helix by apache.
the class ZkIntegrationTestBase method enableHealthCheck.
protected void enableHealthCheck(String clusterName) {
ConfigScope scope = new ConfigScopeBuilder().forCluster(clusterName).build();
new ConfigAccessor(_gZkClient).set(scope, "healthChange" + ".enabled", "" + true);
}
use of org.apache.helix.ConfigAccessor in project helix by apache.
the class ZkIntegrationTestBase method enableDelayRebalanceInCluster.
protected void enableDelayRebalanceInCluster(ZkClient zkClient, String clusterName, boolean enabled) {
ConfigAccessor configAccessor = new ConfigAccessor(zkClient);
ClusterConfig clusterConfig = configAccessor.getClusterConfig(clusterName);
clusterConfig.setDelayRebalaceEnabled(enabled);
configAccessor.setClusterConfig(clusterName, clusterConfig);
}
use of org.apache.helix.ConfigAccessor in project helix by apache.
the class ZkIntegrationTestBase method enableDelayRebalanceInInstance.
protected void enableDelayRebalanceInInstance(ZkClient zkClient, String clusterName, String instanceName, boolean enabled) {
ConfigAccessor configAccessor = new ConfigAccessor(zkClient);
InstanceConfig instanceConfig = configAccessor.getInstanceConfig(clusterName, instanceName);
instanceConfig.setDelayRebalanceEnabled(enabled);
configAccessor.setInstanceConfig(clusterName, instanceName, instanceConfig);
}
Aggregations