You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Yi Liu (JIRA)" <ji...@apache.org> on 2014/08/13 09:00:18 UTC

[jira] [Created] (HADOOP-10964) Small fix for NetworkTopologyWithNodeGroup#sortByDistance

Yi Liu created HADOOP-10964:
-------------------------------

             Summary: Small fix for NetworkTopologyWithNodeGroup#sortByDistance
                 Key: HADOOP-10964
                 URL: https://issues.apache.org/jira/browse/HADOOP-10964
             Project: Hadoop Common
          Issue Type: Bug
    Affects Versions: 2.6.0
            Reporter: Yi Liu
            Assignee: Yi Liu
            Priority: Minor


{{nodes.length}} should be {{activeLen}}.
{code}
  @Override
  public void sortByDistance(Node reader, Node[] nodes, int activeLen,
      long seed, boolean randomizeBlockLocationsPerBlock) {
    // If reader is not a datanode (not in NetworkTopology tree), we need to
    // replace this reader with a sibling leaf node in tree.
    if (reader != null && !this.contains(reader)) {
      Node nodeGroup = getNode(reader.getNetworkLocation());
      if (nodeGroup != null && nodeGroup instanceof InnerNode) {
        InnerNode parentNode = (InnerNode) nodeGroup;
        // replace reader with the first children of its parent in tree
        reader = parentNode.getLeaf(0, null);
      } else {
        return;
      }
    }
    super.sortByDistance(reader, nodes, nodes.length, seed,
        randomizeBlockLocationsPerBlock);
  }
{code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)