Package com.linkedin.helix.model

Examples of com.linkedin.helix.model.HealthStat


    for(String instance : instancesInCluster)
    {
      ZNRecord record = new ZNRecord("scnTable");
      record.setSimpleField("k1", "v1");
      Builder kb = accessor.keyBuilder();
      accessor.setProperty(kb.healthReport(instance, "scnTable"), new HealthStat(record));
    }

    String path = "INSTANCES/*/HEALTHREPORT/scnTable";
    DataAccessorBasedTupleReader tupleReader = new DataAccessorBasedTupleReader(accessor, manager.getClusterName());
    List<ZNRecord> tuples = tupleReader.get(path);
View Full Code Here


        }
        scnRecord.setMapField(partition, scnDetails);
      }

      Builder kb = accessor.keyBuilder();
      accessor.setProperty(kb.healthReport(instance, "scnTable"), new HealthStat(scnRecord));
    }

    ZNRecordQueryProcessor processor = new ZNRecordQueryProcessor();
    DataAccessorBasedTupleReader tupleReader = new DataAccessorBasedTupleReader(accessor, manager.getClusterName());
View Full Code Here

           record.setMapFields(partitionReport);
         }
     HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();

     Builder keyBuilder = accessor.keyBuilder();
     accessor.setProperty(keyBuilder.healthReport(INSTANCE_NAME, record.getId()), new HealthStat(record));
  }
View Full Code Here

    }

    for(String instanceName : scnTableMap.keySet())
    {
      Builder kb = accessor.keyBuilder();
      accessor.setProperty(kb.healthReport(instanceName, "scnTable"), new HealthStat(scnTableMap.get(instanceName)));
    }

    // kill a node, after a while the master should be the last one in the ideal state pref list
   
    _startCMResultMap.get(instanceDead)._manager.disconnect();
    _startCMResultMap.get(instanceDead)._thread.interrupt();
   
    Thread.sleep(1000);
   
    boolean verifyResult =
        ClusterStateVerifier.verifyByZkCallback(new MasterNbInExtViewVerifier(ZK_ADDR,
                                                                              CLUSTER_NAME));
    Assert.assertTrue(verifyResult);
    Builder kb = accessor.keyBuilder();
    ExternalView ev = accessor.getProperty(kb.externalView(TEST_DB));
    for(String partitionName : idealState.getPartitionSet())
    {
      List<String> prefList = idealState.getPreferenceList(partitionName);
      if(prefList.get(0).equals(instanceDead))
      {
        String last = prefList.get(prefList.size() - 1);
        Assert.assertTrue(ev.getStateMap(partitionName).get(last).equals("MASTER"));
      }
    }
   
    // Bring up the previous dead node, but as the SCN is the last for all the
    // master partitions on it, the master partitions should be still on the last if the prefList
    StartCMResult result =
        TestHelper.startDummyProcess(ZK_ADDR, CLUSTER_NAME, instanceDead);
    _startCMResultMap.put(instanceDead, result);

    Thread.sleep(1000);
    verifyResult =
        ClusterStateVerifier.verifyByZkCallback(new MasterNbInExtViewVerifier(ZK_ADDR,
                                                                              CLUSTER_NAME));
    Assert.assertTrue(verifyResult);
    for(String partitionName : idealState.getPartitionSet())
    {
      List<String> prefList = idealState.getPreferenceList(partitionName);
      if(prefList.get(0).equals(instanceDead))
      {
        String last = prefList.get(prefList.size() - 1);
        Assert.assertTrue(ev.getStateMap(partitionName).get(last).equals("MASTER"));
      }
    }
    // Reset the scn of the partitions
    for(int j = 0; j < _PARTITIONS; j++)
    {
      String partition = TEST_DB + "_" + j;
      List<String> idealStatePrefList =
          idealState.getPreferenceList(partition);
      String idealStateMaster = idealStatePrefList.get(0);
      // Switch back the scn to the same
      if(idealStateMaster.equals(instanceDead))
      {
        for(int x = 0; x < idealStatePrefList.size(); x++)
        {
          String instance = idealStatePrefList.get(x);
          ZNRecord scnRecord = scnTableMap.get(instance);
          if(!scnRecord.getMapFields().containsKey(partition))
          {
            scnRecord.setMapField(partition, new HashMap<String, String>());
          }
          Map<String, String> scnDetails = scnRecord.getMapField(partition);
          scnDetails.put("gen", "4");
          scnDetails.put("seq", "100");
        }
      }
    }
    // set the scn to normal -- same order as the priority list
    for(String instanceName : scnTableMap.keySet())
    {
      kb = accessor.keyBuilder();
      accessor.setProperty(kb.healthReport(instanceName, "scnTable"), new HealthStat(scnTableMap.get(instanceName)));
    }
    Thread.sleep(1000);
    verifyResult =
        ClusterStateVerifier.verifyByZkCallback(new MasterNbInExtViewVerifier(ZK_ADDR,
                                                                              CLUSTER_NAME));
View Full Code Here

      record.setSimpleField("TimeStamp", new Date().getTime() + "");
      record.setMapField(_statName, valMap);
      HelixDataAccessor helixDataAccessor = manager.getHelixDataAccessor();
      Builder keyBuilder = helixDataAccessor.keyBuilder();
      helixDataAccessor
        .setProperty(keyBuilder.healthReport( manager.getInstanceName(), record.getId()), new HealthStat(record))
    }
    try
    {
      Thread.sleep(1000);
    }
View Full Code Here

      record.setSimpleField("TimeStamp", new Date().getTime() + "");
      record.setMapField(_statName, valMap);
      HelixDataAccessor helixDataAccessor = manager.getHelixDataAccessor();
      Builder keyBuilder = helixDataAccessor.keyBuilder();
      helixDataAccessor
        .setProperty(keyBuilder.healthReport( manager.getInstanceName(), record.getId()), new HealthStat(record));
    }
    try
    {
      Thread.sleep(1000);
    }
View Full Code Here

      record.setSimpleField("TimeStamp", new Date().getTime() + "");
      record.setMapField("TestStat@DB=TestDB;Partition=TestDB_3", valMap);
      HelixDataAccessor helixDataAccessor = manager.getHelixDataAccessor();
      Builder keyBuilder = helixDataAccessor.keyBuilder();
      helixDataAccessor
        .setProperty(keyBuilder.healthReport( manager.getInstanceName(), record.getId()), new HealthStat(record));
    }
    try
    {
      Thread.sleep(1000);
    }
View Full Code Here

      {
        for (int i = 0; i < 5; i++)
        {
//          System.out.println(instance + " sets healthReport: " + "mockAlerts" + i);
          accessor.setProperty(keyBuilder.healthReport(instance, "mockAlerts"),
                               new HealthStat(new ZNRecord("mockAlerts" + i)));
        }
      }
    }
View Full Code Here

    Builder keyBuilder = accessor.keyBuilder();
//    accessor.setProperty(
//        PropertyType.HEALTHREPORT, healthCheckInfoUpdate, _instanceName,
//        healthCheckInfoUpdate.getId());
    accessor.setProperty(keyBuilder.healthReport(_instanceName, healthCheckInfoUpdate.getId()),
                         new HealthStat(healthCheckInfoUpdate));

  }
View Full Code Here

          record.setSimpleField(StatsHolder.TIMESTAMP_NAME, "" + System.currentTimeMillis());
         
          HelixDataAccessor accessor = _helixManager.getHelixDataAccessor();
          Builder keyBuilder = accessor.keyBuilder();
          accessor.setProperty(keyBuilder.healthReport(_instanceName, record.getId()),
                               new HealthStat(record));

//          _helixManager.getDataAccessor().setProperty(
//              PropertyType.HEALTHREPORT, record, _instanceName, record.getId());
          // reset stats (for now just the partition stats)
          provider.resetStats();
View Full Code Here

TOP

Related Classes of com.linkedin.helix.model.HealthStat

Copyright © 2018 www.massapicom. 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.