Revert "HDFS-4937. ReplicationMonitor can infinite-loop in BlockPlacementPolicyDefault#chooseRandom(). Contributed by Kihwal Lee."
This reverts commit 0c7fd26302109273a07b6087a9b92c9dff080816. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/caa5da06 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/caa5da06 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/caa5da06 Branch: refs/heads/branch-2 Commit: caa5da06f2c1bf4450d0760287312dc284dc74f9 Parents: 511e724 Author: yliu <[email protected]> Authored: Sat Oct 31 16:23:26 2015 +0800 Committer: yliu <[email protected]> Committed: Sat Oct 31 16:23:26 2015 +0800 ---------------------------------------------------------------------- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 --- .../blockmanagement/BlockPlacementPolicyDefault.java | 12 ------------ 2 files changed, 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/caa5da06/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 6c735bc..40ef124 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1364,9 +1364,6 @@ Release 2.8.0 - UNRELEASED HDFS-9332. Fix Precondition failures from NameNodeEditLogRoller while saving namespace. (wang) - HDFS-4937. ReplicationMonitor can infinite-loop in - BlockPlacementPolicyDefault#chooseRandom() (kihwal) - Release 2.7.2 - UNRELEASED INCOMPATIBLE CHANGES http://git-wip-us.apache.org/repos/asf/hadoop/blob/caa5da06/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java index f610574..d9b8d60 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java @@ -659,7 +659,6 @@ public class BlockPlacementPolicyDefault extends BlockPlacementPolicy { int numOfAvailableNodes = clusterMap.countNumOfAvailableNodes( scope, excludedNodes); - int refreshCounter = numOfAvailableNodes; StringBuilder builder = null; if (LOG.isDebugEnabled()) { builder = debugLoggingBuilder.get(); @@ -709,17 +708,6 @@ public class BlockPlacementPolicyDefault extends BlockPlacementPolicy { // If no candidate storage was found on this DN then set badTarget. badTarget = (storage == null); } - // Refresh the node count. If the live node count became smaller, - // but it is not reflected in this loop, it may loop forever in case - // the replicas/rack cannot be satisfied. - if (--refreshCounter == 0) { - refreshCounter = clusterMap.countNumOfAvailableNodes(scope, - excludedNodes); - // It has already gone through enough number of nodes. - if (refreshCounter <= excludedNodes.size()) { - break; - } - } } if (numOfReplicas>0) {
