Browse Source

HADOOP-1083. Fix so that when a cluster restarts with a missing datanode, its blocks are replicated.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@515843 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 years ago
parent
commit
a3270ff7e8
2 changed files with 8 additions and 3 deletions
  1. 4 0
      CHANGES.txt
  2. 4 3
      src/java/org/apache/hadoop/dfs/FSNamesystem.java

+ 4 - 0
CHANGES.txt

@@ -21,6 +21,10 @@ Trunk (unreleased changes)
  5. HADOOP-1077.  Fix a race condition fetching map outputs that could
     hang reduces.  (Devaraj Das via cutting)
 
+ 6. HADOOP-1083.  Fix so that when a cluster restarts with a missing
+    datanode, its blocks are replicated.  (Hairong Kuang via cutting)
+
+
 Release 0.12.0 - 2007-03-02
 
  1. HADOOP-975.  Separate stdout and stderr from tasks.

+ 4 - 3
src/java/org/apache/hadoop/dfs/FSNamesystem.java

@@ -2115,7 +2115,8 @@ class FSNamesystem implements FSConstants {
             return block;
         
         // filter out containingNodes that are marked for decommission.
-        int numCurrentReplica = countContainingNodes(containingNodes);
+        int numCurrentReplica = countContainingNodes(containingNodes)
+                              + pendingReplications.getNumReplicas(block);
         
         // check whether safe replication is reached for the block
         // only if it is a part of a files
@@ -2123,8 +2124,8 @@ class FSNamesystem implements FSConstants {
         
         // handle underReplication/overReplication
         short fileReplication = fileINode.getReplication();
-        if(neededReplications.contains(block)) {
-            neededReplications.update(block, curReplicaDelta, 0);
+        if(numCurrentReplica < fileReplication) {
+          neededReplications.update(block, curReplicaDelta, 0);
         }
         proccessOverReplicatedBlock( block, fileReplication );
         return block;