Author: hairong
Date: Tue Mar 17 20:02:23 2009
New Revision: 755375

URL: http://svn.apache.org/viewvc?rev=755375&view=rev
Log:
Merge -r 755369:755370 to move the change of HADOOP-5479 from main to branch 
0.19.

Modified:
    hadoop/core/branches/branch-0.19/   (props changed)
    hadoop/core/branches/branch-0.19/CHANGES.txt   (contents, props changed)
    
hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java
    
hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java

Propchange: hadoop/core/branches/branch-0.19/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 17 20:02:23 2009
@@ -1 +1 @@
-/hadoop/core/trunk:697306,698176,699056,699098,699415,699424,699444,699490,699517,700163,700628,700923,701273,701398,703923,704203,704261,704701,704703,704707,704712,704732,704748,704989,705391,705420,705430,705762,706350,706707,706719,706796,706802,707258,707262,708623,708641,708710,709040,709303,712881,713888,720602,723013,723460,723831,723918,724883,727117,727212,727217,727228,727869,732572,732777,733887,734870,736426,738697,740077,741703,741762,743745,743892,745180,746902-746903,752073,752609,752836,753112-753113,753346
+/hadoop/core/trunk:697306,698176,699056,699098,699415,699424,699444,699490,699517,700163,700628,700923,701273,701398,703923,704203,704261,704701,704703,704707,704712,704732,704748,704989,705391,705420,705430,705762,706350,706707,706719,706796,706802,707258,707262,708623,708641,708710,709040,709303,712881,713888,720602,723013,723460,723831,723918,724883,727117,727212,727217,727228,727869,732572,732777,733887,734870,736426,738697,740077,741703,741762,743745,743892,745180,746902-746903,752073,752609,752836,753112-753113,753346,755370

Modified: hadoop/core/branches/branch-0.19/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.19/CHANGES.txt?rev=755375&r1=755374&r2=755375&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.19/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.19/CHANGES.txt Tue Mar 17 20:02:23 2009
@@ -74,9 +74,10 @@
     HADOOP-5449. Fixes the history cleaner thread. 
     (Amareshwari Sriramadasu via ddas)
  
-Release 0.19.1 - 2009-02-23
+    HADOOP-5479. NameNode should not send empty block replication request to
+    DataNode. (hairong)
 
-  INCOMPATIBLE CHANGES
+Release 0.19.1 - 2009-02-23
 
     HADOOP-5225. Workaround for tmp file handling in HDFS. sync() is 
     incomplete as a result. committed only to 0.19.x. (Raghu Angadi)

Propchange: hadoop/core/branches/branch-0.19/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 17 20:02:23 2009
@@ -1,3 +1,3 @@
 /hadoop/core/branches/branch-0.18/CHANGES.txt:727226
 /hadoop/core/branches/branch-0.20/CHANGES.txt:752591
-/hadoop/core/trunk/CHANGES.txt:697306,698176,699056,699098,699415,699424,699444,699490,699517,700163,700628,700923,701273,701398,703923,704203,704261,704701,704703,704707,704712,704732,704748,704989,705391,705420,705430,705762,706350,706707,706719,706796,706802,707258,707262,708623,708641,708710,708723,709040,709303,711717,712881,713888,720602,723013,723460,723831,723918,724883,727117,727212,727217,727228,727869,732572,732777,733887,734870,735082,736426,738697,740077,741703,741762,743296,743745,743892,745180,746902-746903,752073,752590,752609,752836,753112-753113,753346
+/hadoop/core/trunk/CHANGES.txt:697306,698176,699056,699098,699415,699424,699444,699490,699517,700163,700628,700923,701273,701398,703923,704203,704261,704701,704703,704707,704712,704732,704748,704989,705391,705420,705430,705762,706350,706707,706719,706796,706802,707258,707262,708623,708641,708710,708723,709040,709303,711717,712881,713888,720602,723013,723460,723831,723918,724883,727117,727212,727217,727228,727869,732572,732777,733887,734870,735082,736426,738697,740077,741703,741762,743296,743745,743892,745180,746902-746903,752073,752590,752609,752836,753112-753113,753346,755370

Modified: 
hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java
URL: 
http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java?rev=755375&r1=755374&r2=755375&view=diff
==============================================================================
--- 
hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java
 (original)
+++ 
hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/namenode/DatanodeDescriptor.java
 Tue Mar 17 20:02:23 2009
@@ -68,20 +68,16 @@
     }
 
     /** Dequeue */
-    synchronized List<BlockTargetPair> poll(int numTargets) {
-      if (numTargets <= 0 || blockq.isEmpty()) {
+    synchronized List<BlockTargetPair> poll(int numBlocks) {
+      if (numBlocks <= 0 || blockq.isEmpty()) {
         return null;
       }
-      else {
-        List<BlockTargetPair> results = new ArrayList<BlockTargetPair>();
-        for(; !blockq.isEmpty() && numTargets > 0; ) {
-          numTargets -= blockq.peek().targets.length; 
-          if (numTargets >= 0) {
-            results.add(blockq.poll());
-          }
-        }
-        return results;
+
+      List<BlockTargetPair> results = new ArrayList<BlockTargetPair>();
+      for(; !blockq.isEmpty() && numBlocks > 0; numBlocks--) {
+        results.add(blockq.poll());
       }
+      return results;
     }
   }
 

Modified: 
hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
URL: 
http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=755375&r1=755374&r2=755375&view=diff
==============================================================================
--- 
hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
 (original)
+++ 
hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
 Tue Mar 17 20:02:23 2009
@@ -2463,12 +2463,8 @@
         }
 
         // choose replication targets
-        int maxTargets = 
-          maxReplicationStreams - srcNode.getNumberOfBlocksToBeReplicated();
-        assert maxTargets > 0 : "Datanode " + srcNode.getName() 
-              + " should have not been selected as a source for replication.";
         DatanodeDescriptor targets[] = replicator.chooseTarget(
-            Math.min(requiredReplication - numEffectiveReplicas, maxTargets),
+            requiredReplication - numEffectiveReplicas,
             srcNode, containingNodes, null, block.getNumBytes());
         if(targets.length == 0)
           continue;
@@ -2483,13 +2479,15 @@
         // Move the block-replication into a "pending" state.
         // The reason we use 'pending' is so we can retry
         // replications that fail after an appropriate amount of time.
+        pendingReplications.add(block, targets.length);
+        NameNode.stateChangeLog.debug(
+            "BLOCK* block " + block
+            + " is moved from neededReplications to pendingReplications");
+        
+        // remove from neededReplications
         if(numEffectiveReplicas + targets.length >= requiredReplication) {
           neededReplicationsIterator.remove(); // remove from 
neededReplications
           replIndex--;
-          pendingReplications.add(block, targets.length);
-          NameNode.stateChangeLog.debug(
-              "BLOCK* block " + block
-              + " is moved from neededReplications to pendingReplications");
         }
         if (NameNode.stateChangeLog.isInfoEnabled()) {
           StringBuffer targetList = new StringBuffer("datanode(s)");


Reply via email to