[ 
https://issues.apache.org/jira/browse/HADOOP-10964?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yi Liu updated HADOOP-10964:
----------------------------

    Attachment: HADOOP-10964.001.patch

We should keeep decommissioned/stale datanodes to the bottom.

> 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
>         Attachments: HADOOP-10964.001.patch
>
>
> {{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)

Reply via email to