hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r504664 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/dfs/FSNamesystem.java
Date Wed, 07 Feb 2007 19:55:30 GMT
Author: cutting
Date: Wed Feb  7 11:55:29 2007
New Revision: 504664

URL: http://svn.apache.org/viewvc?view=rev&rev=504664
Log:
HADOOP-987.  Fix a problem in HDFS where blocks were not removed from neededReplications after
a replication targer was selected.  Contributed by Hairong.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=504664&r1=504663&r2=504664
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed Feb  7 11:55:29 2007
@@ -12,6 +12,10 @@
     HADOOP-331.  If a map output is unavailable, the job tracker is
     once more informed.  (Arun C Murthy via cutting)
 
+ 4. HADOOP-987.  Fix a problem in HDFS where blocks were not removed
+    from neededReplications after a replication target was selected.
+    (Hairong Kuang via cutting)
+
 
 Release 0.11.0 - 2007-02-02
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java?view=diff&rev=504664&r1=504663&r2=504664
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java Wed Feb  7 11:55:29
2007
@@ -330,6 +330,14 @@
             return size;
         }
         
+        /* Check if a block is in the neededReplication queue */
+        synchronized boolean contains(Block block) {
+            for(TreeSet<Block> set:priorityQueues) {
+                if(set.contains(block)) return true;
+            }
+            return false;
+        }
+        
         /* Return the priority of a block
         * @param block a under replication block
         * @param curReplicas current number of replicas of the block
@@ -1867,7 +1875,9 @@
         
         // handle underReplication/overReplication
         short fileReplication = fileINode.getReplication();
-        neededReplications.update(block, curReplicaDelta, 0);
+        if(neededReplications.contains(block)) {
+            neededReplications.update(block, curReplicaDelta, 0);
+        }
         if (numCurrentReplica >= fileReplication ) {
             pendingReplications.remove(block);
         }        
@@ -2471,9 +2481,9 @@
                       (DatanodeDescriptor[]) replicateTargetSets.get(i);
             int numCurrentReplica = numCurrentReplicas.get(i).intValue();
             int numExpectedReplica = dir.getFileByBlock( block).getReplication(); 
-            neededReplications.update(
-                    block, numCurrentReplica, numExpectedReplica);
             if (numCurrentReplica + targets.length >= numExpectedReplica) {
+              neededReplications.remove(
+                      block, numCurrentReplica, numExpectedReplica);
               pendingReplications.add(block);
               NameNode.stateChangeLog.debug(
                 "BLOCK* NameSystem.pendingTransfer: "



Mime
View raw message