helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Brandt (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HELIX-513) ZKHelixAdmin#rebalance with group uses instances from other groups
Date Fri, 05 Sep 2014 17:07:28 GMT
Greg Brandt created HELIX-513:

             Summary: ZKHelixAdmin#rebalance with group uses instances from other groups
                 Key: HELIX-513
                 URL: https://issues.apache.org/jira/browse/HELIX-513
             Project: Apache Helix
          Issue Type: Bug
          Components: helix-core
    Affects Versions: 0.6.3, 0.7.1
            Reporter: Greg Brandt

For example, consider a cluster with one instance with tag NOT_YOURS and a resource whose
ideal state has INSTANCE_GROUP_TAG=MINE. If we call

manager.rebalance("MY_CLUSTER", "MY_RESOURCE", 1, null, "MINE")

Helix will find no instances with the tag "MINE", so it will instead use all available instances
in the cluster to perform the rebalance.

This has undesirable effects when groups are used for multi-tenant clusters (i.e. subsets
of instances belong to individual tenants, and tenants should not share instances).

Better behavior might be to error out at the point no tagged instances are found.

  public void rebalance(String clusterName, String resourceName, int replica, String keyPrefix,
      String group) {
    List<String> instanceNames = new LinkedList<String>();
    if (keyPrefix == null || keyPrefix.length() == 0) {
      keyPrefix = resourceName;
    if (group != null && group.length() > 0) {
      instanceNames = getInstancesInClusterWithTag(clusterName, group);
    if (instanceNames.size() == 0) {
      // OLD
      //logger.info("No tags found for resource " + resourceName + ", use all instances");
      //instanceNames = getInstancesInCluster(clusterName);
      //group = "";
      // NEW
      throw new IllegalStateException("No tags found for resource ...");
    } else {
      logger.info("Found instances with tag for " + resourceName + " " + instanceNames);
    rebalance(clusterName, resourceName, replica, keyPrefix, instanceNames, group);

This message was sent by Atlassian JIRA

View raw message