Search in sources :

Example 6 with StateTransitionThrottleConfig

use of org.apache.helix.api.config.StateTransitionThrottleConfig 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);
}
Also used : StateTransitionThrottleConfig(org.apache.helix.api.config.StateTransitionThrottleConfig) ClusterConfig(org.apache.helix.model.ClusterConfig)

Example 7 with StateTransitionThrottleConfig

use of org.apache.helix.api.config.StateTransitionThrottleConfig in project helix by apache.

the class TestPartitionMovementThrottle method setupThrottleConfig.

private void setupThrottleConfig() {
    ClusterConfig clusterConfig = _configAccessor.getClusterConfig(CLUSTER_NAME);
    StateTransitionThrottleConfig resourceLoadThrottle = new StateTransitionThrottleConfig(StateTransitionThrottleConfig.RebalanceType.LOAD_BALANCE, StateTransitionThrottleConfig.ThrottleScope.RESOURCE, 2);
    StateTransitionThrottleConfig instanceLoadThrottle = new StateTransitionThrottleConfig(StateTransitionThrottleConfig.RebalanceType.LOAD_BALANCE, StateTransitionThrottleConfig.ThrottleScope.INSTANCE, 2);
    StateTransitionThrottleConfig clusterLoadThrottle = new StateTransitionThrottleConfig(StateTransitionThrottleConfig.RebalanceType.LOAD_BALANCE, StateTransitionThrottleConfig.ThrottleScope.CLUSTER, 100);
    StateTransitionThrottleConfig resourceRecoveryThrottle = new StateTransitionThrottleConfig(StateTransitionThrottleConfig.RebalanceType.RECOVERY_BALANCE, StateTransitionThrottleConfig.ThrottleScope.RESOURCE, 3);
    StateTransitionThrottleConfig clusterRecoveryThrottle = new StateTransitionThrottleConfig(StateTransitionThrottleConfig.RebalanceType.RECOVERY_BALANCE, StateTransitionThrottleConfig.ThrottleScope.CLUSTER, 100);
    clusterConfig.setStateTransitionThrottleConfigs(Arrays.asList(resourceLoadThrottle, instanceLoadThrottle, clusterLoadThrottle, resourceRecoveryThrottle, clusterRecoveryThrottle));
    clusterConfig.setPersistIntermediateAssignment(true);
    _configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig);
}
Also used : StateTransitionThrottleConfig(org.apache.helix.api.config.StateTransitionThrottleConfig) ClusterConfig(org.apache.helix.model.ClusterConfig)

Example 8 with StateTransitionThrottleConfig

use of org.apache.helix.api.config.StateTransitionThrottleConfig in project helix by apache.

the class TestPartitionMovementThrottle method setSingleThrottlingConfig.

private void setSingleThrottlingConfig(StateTransitionThrottleConfig.RebalanceType rebalanceType, StateTransitionThrottleConfig.ThrottleScope scope, int maxStateTransitions) {
    ClusterConfig clusterConfig = _configAccessor.getClusterConfig(CLUSTER_NAME);
    StateTransitionThrottleConfig anyTypeInstanceThrottle = new StateTransitionThrottleConfig(rebalanceType, scope, maxStateTransitions);
    List<StateTransitionThrottleConfig> currentThrottleConfigs = clusterConfig.getStateTransitionThrottleConfigs();
    currentThrottleConfigs.add(anyTypeInstanceThrottle);
    clusterConfig.setStateTransitionThrottleConfigs(currentThrottleConfigs);
    _configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig);
}
Also used : StateTransitionThrottleConfig(org.apache.helix.api.config.StateTransitionThrottleConfig) ClusterConfig(org.apache.helix.model.ClusterConfig)

Example 9 with StateTransitionThrottleConfig

use of org.apache.helix.api.config.StateTransitionThrottleConfig in project helix by apache.

the class TestRebalancerMetrics method setupThrottleConfig.

private void setupThrottleConfig(ClusterConfig clusterConfig, StateTransitionThrottleConfig.RebalanceType rebalanceType, int maxPending) {
    StateTransitionThrottleConfig resourceThrottle = new StateTransitionThrottleConfig(rebalanceType, StateTransitionThrottleConfig.ThrottleScope.RESOURCE, maxPending);
    clusterConfig.setStateTransitionThrottleConfigs(Arrays.asList(resourceThrottle));
}
Also used : StateTransitionThrottleConfig(org.apache.helix.api.config.StateTransitionThrottleConfig)

Aggregations

StateTransitionThrottleConfig (org.apache.helix.api.config.StateTransitionThrottleConfig)9 ClusterConfig (org.apache.helix.model.ClusterConfig)7 ArrayList (java.util.ArrayList)2 Test (org.testng.annotations.Test)2 ClusterControllerManager (org.apache.helix.integration.manager.ClusterControllerManager)1 MockParticipantManager (org.apache.helix.integration.manager.MockParticipantManager)1 ZKHelixDataAccessor (org.apache.helix.manager.zk.ZKHelixDataAccessor)1 ErrTransition (org.apache.helix.mock.participant.ErrTransition)1 Partition (org.apache.helix.model.Partition)1 Resource (org.apache.helix.model.Resource)1 BestPossibleExternalViewVerifier (org.apache.helix.tools.ClusterVerifiers.BestPossibleExternalViewVerifier)1