diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 2320019f5d..770b068432 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -133,6 +133,9 @@ Release 0.23.1 - UNRELEASED BUG FIXES + HDFS-2541. For a sufficiently large value of blocks, the DN Scanner + may request a random number with a negative seed value. (harsh) + Release 0.23.0 - 2011-11-01 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceScanner.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceScanner.java index 579eb8ed1a..a666149beb 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceScanner.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceScanner.java @@ -34,7 +34,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; -import java.util.Random; import java.util.TreeSet; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -252,8 +251,9 @@ private synchronized long getNewBlockScanTime() { */ long period = Math.min(scanPeriod, Math.max(blockMap.size(),1) * 600 * 1000L); + int periodInt = Math.abs((int)period); return System.currentTimeMillis() - scanPeriod + - DFSUtil.getRandom().nextInt((int)period); + DFSUtil.getRandom().nextInt(periodInt); } /** Adds block to list of blocks */