diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index dc8d4b0be9..c7bd427233 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -275,6 +275,9 @@ Release 0.23.1 - UNRELEASED HDFS-2640. Javadoc generation hangs. (tomwhite) + HDFS-2553. Fix BlockPoolSliceScanner spinning in a tight loop (Uma + Maheswara Rao G via todd) + 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 a666149beb..1f45a7bb56 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 @@ -450,14 +450,14 @@ private void verifyBlock(ExtendedBlock block) { } private synchronized long getEarliestScanTime() { - if ( blockInfoSet.size() > 0 ) { + if (!blockInfoSet.isEmpty()) { return blockInfoSet.first().lastScanTime; } return Long.MAX_VALUE; } private synchronized boolean isFirstBlockProcessed() { - if (blockInfoSet.size() > 0 ) { + if (!blockInfoSet.isEmpty()) { long blockId = blockInfoSet.first().block.getBlockId(); if ((processedBlocks.get(blockId) != null) && (processedBlocks.get(blockId) == 1)) { @@ -471,7 +471,7 @@ private synchronized boolean isFirstBlockProcessed() { private void verifyFirstBlock() { Block block = null; synchronized (this) { - if ( blockInfoSet.size() > 0 ) { + if (!blockInfoSet.isEmpty()) { block = blockInfoSet.first().block; } } @@ -560,7 +560,7 @@ private boolean assignInitialVerificationTimes() { * lastModificationTime > 0. */ synchronized (this) { - if (blockInfoSet.size() > 0 ) { + if (!blockInfoSet.isEmpty()) { BlockScanInfo info; while ((info = blockInfoSet.first()).lastScanTime < 0) { delBlockInfo(info); @@ -630,7 +630,7 @@ public void scan() { } } if (((now - getEarliestScanTime()) >= scanPeriod) - || (!(this.isFirstBlockProcessed()))) { + || ((!blockInfoSet.isEmpty()) && !(this.isFirstBlockProcessed()))) { verifyFirstBlock(); } else { if (LOG.isDebugEnabled()) {