hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r423856 - /lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java
Date Thu, 20 Jul 2006 09:42:14 GMT
Author: cutting
Date: Thu Jul 20 02:42:13 2006
New Revision: 423856

URL: http://svn.apache.org/viewvc?rev=423856&view=rev
Log:
Fix a bug in HADOOP-347.

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

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?rev=423856&r1=423855&r2=423856&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java Thu Jul 20 02:42:13
2006
@@ -1947,11 +1947,12 @@
     public String randomDataNode() {
       int size = datanodeMap.size();
       int index = 0;
-      if (size != 0)
-        index = r.nextInt() % size;
-      DatanodeInfo d = getDatanodeByIndex(index);
-      if (d != null) {
-        return d.getHost();
+      if (size != 0) {
+        index = r.nextInt(size);
+        DatanodeInfo d = getDatanodeByIndex(index);
+        if (d != null) {
+          return d.getHost();
+        }
       }
       return null;
     }



Mime
View raw message