Search in sources :

Example 31 with ConfigAccessor

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

Example 32 with ConfigAccessor

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

Example 33 with ConfigAccessor

use of org.apache.helix.ConfigAccessor in project helix by apache.

the class TestTargetExternalView method beforeClass.

@BeforeClass
public void beforeClass() throws Exception {
    _numDbs = 3;
    _numParitions = 8;
    _numNodes = 4;
    _numReplicas = 2;
    super.beforeClass();
    _configAccessor = new ConfigAccessor(_gZkClient);
    _accessor = _manager.getHelixDataAccessor();
}
Also used : ConfigAccessor(org.apache.helix.ConfigAccessor) BeforeClass(org.testng.annotations.BeforeClass)

Example 34 with ConfigAccessor

use of org.apache.helix.ConfigAccessor in project helix by apache.

the class TestBatchEnableInstances method beforeClass.

@BeforeClass
public void beforeClass() throws Exception {
    _numDbs = 1;
    _numReplicas = 3;
    _numNodes = 5;
    _numParitions = 4;
    super.beforeClass();
    _accessor = new ConfigAccessor(_gZkClient);
}
Also used : ConfigAccessor(org.apache.helix.ConfigAccessor) BeforeClass(org.testng.annotations.BeforeClass)

Example 35 with ConfigAccessor

use of org.apache.helix.ConfigAccessor in project helix by apache.

the class TestClusterVerifier method beforeMethod.

@BeforeMethod
public void beforeMethod() throws InterruptedException {
    final int NUM_PARTITIONS = 10;
    final int NUM_REPLICAS = 3;
    // Cluster and resource setup
    String className = TestHelper.getTestClassName();
    String methodName = TestHelper.getTestMethodName();
    _clusterName = className + "_" + methodName;
    _setupTool = new ClusterSetup(ZK_ADDR);
    _admin = _setupTool.getClusterManagementTool();
    _setupTool.addCluster(_clusterName, true);
    _setupTool.addResourceToCluster(_clusterName, RESOURCES[0], NUM_PARTITIONS, BuiltInStateModelDefinitions.MasterSlave.name(), RebalanceMode.SEMI_AUTO.toString());
    _setupTool.addResourceToCluster(_clusterName, RESOURCES[1], NUM_PARTITIONS, BuiltInStateModelDefinitions.OnlineOffline.name(), RebalanceMode.SEMI_AUTO.toString());
    _setupTool.addResourceToCluster(_clusterName, RESOURCES[2], NUM_PARTITIONS, BuiltInStateModelDefinitions.MasterSlave.name(), RebalanceMode.FULL_AUTO.toString());
    _setupTool.addResourceToCluster(_clusterName, RESOURCES[3], NUM_PARTITIONS, BuiltInStateModelDefinitions.OnlineOffline.name(), RebalanceMode.FULL_AUTO.toString());
    // Enable persist best possible assignment
    ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient);
    ClusterConfig clusterConfig = configAccessor.getClusterConfig(_clusterName);
    clusterConfig.setPersistBestPossibleAssignment(true);
    configAccessor.setClusterConfig(_clusterName, clusterConfig);
    // Configure and start the participants
    _participants = new MockParticipantManager[RESOURCES.length];
    for (int i = 0; i < _participants.length; i++) {
        String host = "localhost";
        int port = 12918 + i;
        String id = host + '_' + port;
        _setupTool.addInstanceToCluster(_clusterName, id);
        _participants[i] = new MockParticipantManager(ZK_ADDR, _clusterName, id);
        _participants[i].syncStart();
    }
    // Rebalance the resources
    for (int i = 0; i < RESOURCES.length; i++) {
        _setupTool.rebalanceResource(_clusterName, RESOURCES[i], NUM_REPLICAS);
    }
    // Start the controller
    _controller = new ClusterControllerManager(ZK_ADDR, _clusterName, "controller_0");
    _controller.syncStart();
    Thread.sleep(1000);
}
Also used : ClusterControllerManager(org.apache.helix.integration.manager.ClusterControllerManager) MockParticipantManager(org.apache.helix.integration.manager.MockParticipantManager) ConfigAccessor(org.apache.helix.ConfigAccessor) ClusterConfig(org.apache.helix.model.ClusterConfig) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

ConfigAccessor (org.apache.helix.ConfigAccessor)41 ClusterConfig (org.apache.helix.model.ClusterConfig)15 ClusterControllerManager (org.apache.helix.integration.manager.ClusterControllerManager)14 BeforeClass (org.testng.annotations.BeforeClass)14 MockParticipantManager (org.apache.helix.integration.manager.MockParticipantManager)10 ClusterSetup (org.apache.helix.tools.ClusterSetup)9 Date (java.util.Date)7 HelixConfigScope (org.apache.helix.model.HelixConfigScope)7 HelixConfigScopeBuilder (org.apache.helix.model.builder.HelixConfigScopeBuilder)7 Test (org.testng.annotations.Test)7 HelixException (org.apache.helix.HelixException)6 Path (javax.ws.rs.Path)5 BestPossibleExternalViewVerifier (org.apache.helix.tools.ClusterVerifiers.BestPossibleExternalViewVerifier)4 HelixClusterVerifier (org.apache.helix.tools.ClusterVerifiers.HelixClusterVerifier)4 IOException (java.io.IOException)3 HashMap (java.util.HashMap)3 GET (javax.ws.rs.GET)3 HelixManager (org.apache.helix.HelixManager)3 ZNRecord (org.apache.helix.ZNRecord)3 ZKHelixDataAccessor (org.apache.helix.manager.zk.ZKHelixDataAccessor)3