瀏覽代碼

HDFS-2541. For a sufficiently large value of blocks, the DN Scanner may request a random number with a negative seed value. Contributed by Harsh J

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security@1204116 13f79535-47bb-0310-9956-ffa450edef68
Eli Collins 13 年之前
父節點
當前提交
f407b82beb
共有 2 個文件被更改,包括 5 次插入1 次删除
  1. 3 0
      CHANGES.txt
  2. 2 1
      src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataBlockScanner.java

+ 3 - 0
CHANGES.txt

@@ -40,6 +40,9 @@ Release 0.20.206.0 - unreleased
     
     HADOOP-7297. Remove docs for CN and BN, as they aren't present. (harsh)
 
+    HDFS-2541. For a sufficiently large value of blocks, the DN Scanner 
+    may request a random number with a negative seed value. (harsh via eli)
+
   IMPROVEMENTS
 
     MAPREDUCE-2836. Provide option to fail jobs when submitted to

+ 2 - 1
src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataBlockScanner.java

@@ -248,8 +248,9 @@ class DataBlockScanner implements Runnable {
      */
     long period = Math.min(scanPeriod, 
                            Math.max(blockMap.size(),1) * 600 * 1000L);
+    int periodInt = Math.abs((int)period);
     return System.currentTimeMillis() - scanPeriod + 
-           random.nextInt((int)period);    
+           random.nextInt(periodInt);    
   }
 
   /** Adds block to list of blocks */