hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hair...@apache.org
Subject svn commit: r669606 - in /hadoop/core/trunk: CHANGES.txt src/hdfs/org/apache/hadoop/dfs/ReplicationTargetChooser.java
Date Thu, 19 Jun 2008 18:01:47 GMT
Author: hairong
Date: Thu Jun 19 11:01:47 2008
New Revision: 669606

URL: http://svn.apache.org/viewvc?rev=669606&view=rev
Log:
HADOOP-3320. Fix NullPointerException in NetworkTopology.getDistance(). Contributed by Hairong
Kuang.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/hdfs/org/apache/hadoop/dfs/ReplicationTargetChooser.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=669606&r1=669605&r2=669606&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Thu Jun 19 11:01:47 2008
@@ -674,6 +674,9 @@
     HADOOP-3576. Fix NullPointerException when renaming a directory
     to its subdirectory. (Tse Wo (Nicholas), SZE via hairong)
 
+    HADOOP-3320. Fix NullPointerException in NetworkTopology.getDistance().
+    (hairong)
+
 Release 0.17.0 - 2008-05-18
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/trunk/src/hdfs/org/apache/hadoop/dfs/ReplicationTargetChooser.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/hdfs/org/apache/hadoop/dfs/ReplicationTargetChooser.java?rev=669606&r1=669605&r2=669606&view=diff
==============================================================================
--- hadoop/core/trunk/src/hdfs/org/apache/hadoop/dfs/ReplicationTargetChooser.java (original)
+++ hadoop/core/trunk/src/hdfs/org/apache/hadoop/dfs/ReplicationTargetChooser.java Thu Jun
19 11:01:47 2008
@@ -449,10 +449,10 @@
         writer = nodes[0];
       }
       for(;index<nodes.length; index++) {
-        DatanodeDescriptor shortestNode = null;
-        int shortestDistance = Integer.MAX_VALUE;
+        DatanodeDescriptor shortestNode = nodes[index];
+        int shortestDistance = clusterMap.getDistance(writer, shortestNode);
         int shortestIndex = index;
-        for(int i=index; i<nodes.length; i++) {
+        for(int i=index+1; i<nodes.length; i++) {
           DatanodeDescriptor currentNode = nodes[i];
           int currentDistance = clusterMap.getDistance(writer, currentNode);
           if (shortestDistance>currentDistance) {



Mime
View raw message