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

tomscut commented on HDFS-16076:
--------------------------------

The main code changes are as follows:

org.apache.hadoop.hdfs.DFSUtil#StaleAndSlowComparator#compare()

 
{code:java}
@Override
public int compare(DatanodeInfo a, DatanodeInfo b) {
  int ret = super.compare(a, b);
  if (ret != 0) {
    return ret;
  }

  // Stale nodes will be moved behind the normal nodes
  if (avoidStaleDataNodesForRead) {
    boolean aStale = a.isStale(staleInterval);
    boolean bStale = b.isStale(staleInterval);
    ret = aStale == bStale ? 0 : (aStale ? 1 : -1);
    if (ret != 0) {
      return ret;
    }
  }

  // Slow nodes will be moved behind the normal nodes
  if (avoidSlowDataNodesForRead) {
    boolean aSlow = slowNodesUuidSet.contains(a.getDatanodeUuid());
    boolean bSlow = slowNodesUuidSet.contains(b.getDatanodeUuid());
    ret = aSlow == bSlow ? 0 : (aSlow ? 1 : -1);
  }
  return ret;
}
{code}
 

 

> Avoid using slow DataNodes for reading by sorting locations
> -----------------------------------------------------------
>
>                 Key: HDFS-16076
>                 URL: https://issues.apache.org/jira/browse/HDFS-16076
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: hdfs
>            Reporter: tomscut
>            Assignee: tomscut
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> After sorting the expected location list will be: live -> slow -> stale -> 
> staleAndSlow -> entering_maintenance -> decommissioned. This reduces the 
> probability that slow nodes will be used for reading.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to