helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HELIX-599) Support creating/maintaining/routing resources with same names in different instance groups
Date Sun, 05 Jul 2015 06:22:04 GMT

    [ https://issues.apache.org/jira/browse/HELIX-599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14614152#comment-14614152
] 

ASF GitHub Bot commented on HELIX-599:
--------------------------------------

Github user kanakb commented on a diff in the pull request:

    https://github.com/apache/helix/pull/31#discussion_r33892268
  
    --- Diff: helix-core/src/main/java/org/apache/helix/spectator/RoutingTableProvider.java
---
    @@ -73,6 +75,73 @@ public RoutingTableProvider() {
       }
     
       /**
    +   * returns the instances for {resource,partition} pair that are in a specific {state}
if
    +   * aggregateGrouping is turned on, find all resources belongs to the given resourceGroupName
and
    +   * aggregate all partition states from all these resources.
    +   *
    +   * @param resourceName
    +   * @param partitionName
    +   * @param state
    +   * @param groupingEnabled
    +   *
    +   * @return empty list if there is no instance in a given state
    +   */
    +  public List<InstanceConfig> getInstances(String resourceName, String partitionName,
String state,
    +      boolean groupingEnabled) {
    +    if (!groupingEnabled) {
    +      return getInstances(resourceName, partitionName, state);
    +    }
    +
    +    List<InstanceConfig> instanceList = null;
    +    RoutingTable _routingTable = _routingTableRef.get();
    +    ResourceGroupInfo resourceGroupInfo = _routingTable.getResourceGroup(resourceName);
    +    if (resourceGroupInfo != null) {
    +      PartitionInfo keyInfo = resourceGroupInfo.get(partitionName);
    +      if (keyInfo != null) {
    +        instanceList = keyInfo.get(state);
    +      }
    +    }
    +    if (instanceList == null) {
    +      instanceList = Collections.emptyList();
    +    }
    +    return instanceList;
    +  }
    +
    +  /**
    +   * returns the instances for {resource,partition} pair that are in a specific {state}
if
    +   * aggregateGrouping is turned on, find all resources belongs to the given resourceGroupName
and
    +   * having the given resource tags and return the aggregated partition states from all
these
    +   * resources.
    +   *
    +   * @param resourceGroupName
    +   * @param partitionName
    +   * @param state
    +   * @param resourceTags
    +   *
    +   * @return empty list if there is no instance in a given state
    +   */
    +  public List<InstanceConfig> getInstances(String resourceGroupName, String partitionName,
    --- End diff --
    
    Can you clarify the expected naming pattern for partitions in a resource group? Do all
resources have partitions with the same name, or do some, or do none? Does this basically
look at every resource in the resource group for partitions that match, and then return all
instances for all partitions with this name in the resources for this resource group?


> Support creating/maintaining/routing resources with same names in different instance
groups
> -------------------------------------------------------------------------------------------
>
>                 Key: HELIX-599
>                 URL: https://issues.apache.org/jira/browse/HELIX-599
>             Project: Apache Helix
>          Issue Type: New Feature
>          Components: helix-core, helix-webapp-admin
>            Reporter: Lei Xia
>            Assignee: Lei Xia
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> In LinkedIn, we have a new use scenario that there will be multiple databases sitting
in the same Helix cluster with the same name, but on different instance groups.  What we need
are:
>  1) Allow resources (databases) with the same name, these resources are on different
instance groups (with different tags).
>  2) Routing table (Spectator) is able to aggregate and return all instance (from multiple
instance groups) that hold the database with given name.
> Our proposed solution is:
>  1) Add a "Resource Group" field in IdealState for the databases with the same names
from different instance groups
>  2) Use Instance Group Tag (or new "Resource Tag") to differentiate databases (with same
name) from different instance groups.
>  3) Use name mangling for Idealstate, for example, with database TestDB in instance group
"testGroup", the IdealState and ExternalView id would be "TestDB$testGroup". 
>  4) Change Helix Routing Table to be able to aggregate databases from the same resource
group.
>  
> Four new APIs are going to be added to RoutingTableProvider:
> public class RoutingTableProvider {
>  
> /**
>  * returns the instances that contain the given partition in a specific state from all
resources with given resource name
>  */
> public List<InstanceConfig> getInstances(String resource, String partition, String
state);
>  
> /**
>  * returns the instances that contain the given partition in a specific state from selected
resources with given name and tags
>  */
> public List<InstanceConfig> getInstances(String resource, String partition, String
state, List<String> resourceTags);
>  
> /**
>  * returns instances that contain given resource that are in a specific state
>  */
> public Set<InstanceConfig> getInstances(String resource, String state);
>  
> /**
>  * returns instances that contain given resource with tags that are in a specific state
>  */
> public Set<InstanceConfig> getInstances(String resource, String state,  List<String>
groupTags);
> }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message