瀏覽代碼

Revert "HDFS-4937. ReplicationMonitor can infinite-loop in BlockPlacementPolicyDefault#chooseRandom(). Contributed by Kihwal Lee."

This reverts commit 43539b5ff4ac0874a8a454dc93a2a782b0e0ea8f.
yliu 9 年之前
父節點
當前提交
7fd6416759

+ 0 - 3
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -2201,9 +2201,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

+ 0 - 12
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) {