use of org.apache.helix.model.ClusterConfig in project helix by apache.
the class TestStateTransitionPrirority method preSetup.
private void preSetup(StateTransitionThrottleConfig.RebalanceType rebalanceType, Set<String> resourceSet, String priorityField, int numOfLiveInstances, int numOfReplicas) {
setupIdealState(numOfLiveInstances, resourceSet.toArray(new String[resourceSet.size()]), numOfLiveInstances, numOfReplicas, IdealState.RebalanceMode.FULL_AUTO, "MasterSlave");
setupStateModel();
setupLiveInstances(numOfLiveInstances);
// Set up cluster configs
ClusterConfig clusterConfig = accessor.getProperty(accessor.keyBuilder().clusterConfig());
StateTransitionThrottleConfig throttleConfig = new StateTransitionThrottleConfig(rebalanceType, StateTransitionThrottleConfig.ThrottleScope.CLUSTER, 1);
clusterConfig.setStateTransitionThrottleConfigs(Collections.singletonList(throttleConfig));
clusterConfig.setResourcePriorityField(priorityField);
setClusterConfig(clusterConfig);
}
use of org.apache.helix.model.ClusterConfig in project helix by apache.
the class TestStateTransitionThrottle method setupCluster.
private void setupCluster(String clusterName, ZKHelixDataAccessor accessor) throws Exception {
// participant start port
TestHelper.setupCluster(// participant start port
clusterName, // participant start port
ZK_ADDR, // participant start port
12918, // participant name prefix
"localhost", // resource name prefix
resourceNamePrefix, // resources
1, // partitions per resource
15, // number of nodes
participantCount, // replicas
3, "MasterSlave", IdealState.RebalanceMode.FULL_AUTO, // do rebalance
true);
PropertyKey.Builder keyBuilder = accessor.keyBuilder();
ClusterConfig clusterConfig = accessor.getProperty(accessor.keyBuilder().clusterConfig());
clusterConfig.setResourcePriorityField("Name");
List<StateTransitionThrottleConfig> throttleConfigs = new ArrayList<>();
throttleConfigs.add(new StateTransitionThrottleConfig(StateTransitionThrottleConfig.RebalanceType.LOAD_BALANCE, StateTransitionThrottleConfig.ThrottleScope.CLUSTER, 100));
throttleConfigs.add(new StateTransitionThrottleConfig(StateTransitionThrottleConfig.RebalanceType.RECOVERY_BALANCE, StateTransitionThrottleConfig.ThrottleScope.CLUSTER, 100));
clusterConfig.setStateTransitionThrottleConfigs(throttleConfigs);
accessor.setProperty(keyBuilder.clusterConfig(), clusterConfig);
}
use of org.apache.helix.model.ClusterConfig 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.model.ClusterConfig in project helix by apache.
the class ZkIntegrationTestBase method enablePersistBestPossibleAssignment.
protected void enablePersistBestPossibleAssignment(ZkClient zkClient, String clusterName, Boolean enabled) {
ConfigAccessor configAccessor = new ConfigAccessor(zkClient);
ClusterConfig clusterConfig = configAccessor.getClusterConfig(clusterName);
clusterConfig.setPersistBestPossibleAssignment(enabled);
configAccessor.setClusterConfig(clusterName, clusterConfig);
}
use of org.apache.helix.model.ClusterConfig in project helix by apache.
the class ZkIntegrationTestBase method enableTopologyAwareRebalance.
protected void enableTopologyAwareRebalance(ZkClient zkClient, String clusterName, Boolean enabled) {
ConfigAccessor configAccessor = new ConfigAccessor(zkClient);
ClusterConfig clusterConfig = configAccessor.getClusterConfig(clusterName);
clusterConfig.setTopologyAwareEnabled(enabled);
configAccessor.setClusterConfig(clusterName, clusterConfig);
}
Aggregations