hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomwh...@apache.org
Subject svn commit: r529524 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/dfs/FSNamesystem.java
Date Tue, 17 Apr 2007 08:36:21 GMT
Author: tomwhite
Date: Tue Apr 17 01:36:20 2007
New Revision: 529524

URL: http://svn.apache.org/viewvc?view=rev&rev=529524
Log:
HADOOP-1224.  Fix "Browse the filesystem" link to no point longer to dead datanodes.  Contributed
by Enis Soztutar.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=529524&r1=529523&r2=529524
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Tue Apr 17 01:36:20 2007
@@ -216,6 +216,9 @@
 65. HADOOP-1251.  Add a method to Reporter to get the map InputSplit.
     (omalley via cutting)
 
+66. HADOOP-1224.  Fix "Browse the filesystem" link to no longer point 
+    to dead datanodes.  (Enis Soztutar via tomwhite)
+
 
 Release 0.12.3 - 2007-04-06
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java?view=diff&rev=529524&r1=529523&r2=529524
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java Tue Apr 17 01:36:20
2007
@@ -3628,12 +3628,12 @@
   private Host2NodesMap host2DataNodeMap = new Host2NodesMap();
        
   /** Stop at and return the datanode at index (used for content browsing)*/
-  private DatanodeInfo getDatanodeByIndex( int index ) {
+  private DatanodeDescriptor getDatanodeByIndex( int index ) {
     int i = 0;
-    for (Iterator<DatanodeDescriptor> it = datanodeMap.values().iterator(); it.hasNext();
) {
-      DatanodeInfo node = it.next();
-      if( i == index )
+    for (DatanodeDescriptor node : datanodeMap.values()) {
+      if (i == index) {
         return node;
+      }
       i++;
     }
     return null;
@@ -3644,9 +3644,13 @@
     int index = 0;
     if (size != 0) {
       index = r.nextInt(size);
-      DatanodeInfo d = getDatanodeByIndex(index);
-      if (d != null) {
-        return d.getHost() + ":" + d.getInfoPort();
+      for(int i=0; i<size; i++) {
+        DatanodeDescriptor d = getDatanodeByIndex(index);
+        if (d != null && !d.isDecommissioned() && isDatanodeDead(d) &&
+            !d.isDecommissionInProgress()) {
+          return d.getHost() + ":" + d.getInfoPort();
+        }
+        index = (index + 1) % size;
       }
     }
     return null;



Mime
View raw message