Package com.linkedin.helix

Examples of com.linkedin.helix.HelixDataAccessor.keyBuilder()


    Assert.assertEquals(instances.get(0).getInstanceName(), manager.getInstanceName());
    // Update data in the live instance node, should trigger another live instance change
    // event
    HelixDataAccessor helixDataAccessor = manager.getHelixDataAccessor();
    PropertyKey propertyKey =
        helixDataAccessor.keyBuilder().liveInstance(manager.getInstanceName());
    LiveInstance instance = helixDataAccessor.getProperty(propertyKey);

    Map<String, String> map = new TreeMap<String, String>();
    map.put("k1", "v1");
    instance.getRecord().setMapField("test", map);
View Full Code Here


    // kill 1 node

    String instanceName = PARTICIPANT_PREFIX + "_" + (START_PORT + 3);
    HelixDataAccessor _accessor = _startCMResultMap.get(instanceName)._manager.getHelixDataAccessor();
    ExternalView ev = _accessor.getProperty(_accessor.keyBuilder().externalView(TEST_DB));

    for(int i = 0; i < 3; i++)
    {
      String partitionName = TEST_DB + "_" + i;
      List<String> list = new ArrayList<String>();
View Full Code Here

      _startCMResultMap.get(instanceName)._manager.getClusterManagmentTool().enablePartition(false, CLUSTER_NAME, host, TEST_DB, list);
    }

    Thread.sleep(10000);

    ev = _accessor.getProperty(_accessor.keyBuilder().externalView(TEST_DB));
    for(int i = 0; i < 3; i++)
    {
      String partitionName = TEST_DB + "_" + i;
      List<String> list = new ArrayList<String>();
      list.add(partitionName);
View Full Code Here

        (ZkClient) getContext().getAttributes().get(RestAdminApplication.ZKCLIENT);

    HelixDataAccessor accessor =
        ClusterRepresentationUtil.getClusterDataAccessor(zkClient, clusterName);
    Map<String, LiveInstance> liveInstancesMap =
        accessor.getChildValuesMap(accessor.keyBuilder().liveInstances());
    Map<String, InstanceConfig> instanceConfigsMap =
        accessor.getChildValuesMap(accessor.keyBuilder().instanceConfigs());

    for (String instanceName : instanceConfigsMap.keySet())
    {
View Full Code Here

    HelixDataAccessor accessor =
        ClusterRepresentationUtil.getClusterDataAccessor(zkClient, clusterName);
    Map<String, LiveInstance> liveInstancesMap =
        accessor.getChildValuesMap(accessor.keyBuilder().liveInstances());
    Map<String, InstanceConfig> instanceConfigsMap =
        accessor.getChildValuesMap(accessor.keyBuilder().instanceConfigs());

    for (String instanceName : instanceConfigsMap.keySet())
    {
      boolean isAlive = liveInstancesMap.containsKey(instanceName);
      instanceConfigsMap.get(instanceName)
View Full Code Here

    }
    @Override
    public boolean verify()
    {
      HelixDataAccessor accessor = new ZKHelixDataAccessor( _clusterName, new ZkBaseDataAccessor(_client));
      Builder keyBuilder = accessor.keyBuilder();
      int numberOfPartitions = accessor.getProperty(keyBuilder.idealStates(_resourceName)).getRecord().getListFields().size();
      ClusterDataCache cache = new ClusterDataCache();
      cache.refresh(accessor);
      String masterValue = cache.getStateModelDef(cache.getIdealState(_resourceName).getStateModelDefRef()).getStatesPriorityList().get(0);
      int replicas = Integer.parseInt(cache.getIdealState(_resourceName).getReplicas());
View Full Code Here

    command = "-zkSvr localhost:2183 -activateCluster clusterTest1 Klazt3rz false";
    ClusterSetup.processCommandLineArgs(command.split(" "));
    Thread.sleep(6000);
   
    accessor = _startCMResultMap.get("localhost_1231")._manager.getHelixDataAccessor();
    path = accessor.keyBuilder().controllerLeader().getPath();
    Assert.assertFalse(_gZkClient.exists(path));
   
    command = "-zkSvr localhost:2183 -dropCluster clusterTest1";
    assertClusterSetupException(command);
   
View Full Code Here

    // swap instance. The instance get swapped out should not exist anymore
    command = "-zkSvr localhost:2183 -swapInstance clusterTest1 localhost_1232 localhost_12320";
    ClusterSetup.processCommandLineArgs(command.split(" "));
   
    accessor = _startCMResultMap.get("localhost_1231")._manager.getHelixDataAccessor();
    String path = accessor.keyBuilder().instanceConfig("localhost_1232").getPath();
    Assert.assertFalse(_gZkClient.exists(path));
   
    _startCMResultMap.put("localhost_12320", TestHelper.startDummyProcess(ZK_ADDR, "clusterTest1", "localhost_12320"));
  }
View Full Code Here

    command = "-zkSvr localhost:2183 -dropCluster clusterTest1";
    assertClusterSetupException(command);
   
    // verify leader node
    HelixDataAccessor accessor = _startCMResultMap.get("controller_9001")._manager.getHelixDataAccessor();
    LiveInstance controllerLeader = accessor.getProperty(accessor.keyBuilder().controllerLeader());
    Assert.assertTrue(controllerLeader.getInstanceName().startsWith("controller_900"));
   
    accessor = _startCMResultMap.get("localhost_1232")._manager.getHelixDataAccessor();
    LiveInstance leader = accessor.getProperty(accessor.keyBuilder().controllerLeader());
    Assert.assertTrue(leader.getInstanceName().startsWith("controller_900"));
View Full Code Here

                               HelixControllerMain.STANDALONE);

    // round1: controller sends O->S to both node0 and node1
    Thread.sleep(1000);

    Builder keyBuilder = accessor.keyBuilder();
    List<String> messages = accessor.getChildNames(keyBuilder.messages("localhost_0"));
    Assert.assertEquals(messages.size(), 1);
    messages = accessor.getChildNames(keyBuilder.messages("localhost_1"));
    Assert.assertEquals(messages.size(), 1);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.