From ab33fa953bf3ac913e7517e9223e50af5456282f Mon Sep 17 00:00:00 2001 From: Eli Collins Date: Sun, 20 Nov 2011 02:54:05 +0000 Subject: [PATCH] HDFS-2541. svn merge -c 1204114 from trunk git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1204115 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hadoop/hdfs/server/datanode/BlockPoolSliceScanner.java | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 788234c6fc5..60eb1ceeda2 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -31,6 +31,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 579eb8ed1a4..a666149beb1 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.Date; 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 @@ class BlockPoolSliceScanner { */ 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 */