hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject svn commit: r670776 - in /hadoop/core/branches/branch-0.18: CHANGES.txt src/hdfs/org/apache/hadoop/dfs/BlocksMap.java src/hdfs/org/apache/hadoop/dfs/FSNamesystem.java
Date Mon, 23 Jun 2008 21:35:52 GMT
Author: shv
Date: Mon Jun 23 14:35:51 2008
New Revision: 670776

URL: http://svn.apache.org/viewvc?rev=670776&view=rev
Log:
HADOOP-3571. Merge -r 670708:670709 from trunk to branch 0.18.

Modified:
    hadoop/core/branches/branch-0.18/CHANGES.txt
    hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/BlocksMap.java
    hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSNamesystem.java

Modified: hadoop/core/branches/branch-0.18/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/CHANGES.txt?rev=670776&r1=670775&r2=670776&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.18/CHANGES.txt Mon Jun 23 14:35:51 2008
@@ -693,6 +693,8 @@
     HADOOP-3537. Disallow adding a datanode to a network topology when its
     network location is not resolved. (hairong)
 
+    HADOOP-3571. Fix bug in block removal used in lease recovery. (shv)
+
 Release 0.17.0 - 2008-05-18
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/BlocksMap.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/BlocksMap.java?rev=670776&r1=670775&r2=670776&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/BlocksMap.java (original)
+++ hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/BlocksMap.java Mon Jun
23 14:35:51 2008
@@ -156,11 +156,7 @@
      * Remove data-node from the block.
      */
     boolean removeNode(DatanodeDescriptor node) {
-      return removeNode(findDatanode(node));
-    }
-
-    /** Remove the indexed datanode from the block. */
-    boolean removeNode(int dnIndex) {
+      int dnIndex = findDatanode(node);
       if(dnIndex < 0) // the node is not found
         return false;
       assert getPrevious(dnIndex) == null && getNext(dnIndex) == null : 
@@ -336,18 +332,19 @@
   }
 
   /**
-   * Remove the block from the block map.
-   * If the mapped BlockInfo is not null,
-   * it also removes the datanodes associated with the BlockInfo. 
-   */
-  void remove(Block b) {
-    BlockInfo info = map.remove(b);
-    if (info != null) {
-      info.inode = null;
-      for(int n = info.numNodes(); n >= 0; ) {
-        info.removeNode(--n);
-      }
+   * Remove the block from the block map;
+   * remove it from all data-node lists it belongs to;
+   * and remove all data-node locations associated with the block.
+   */
+  void removeBlock(BlockInfo blockInfo) {
+    if (blockInfo == null)
+      return;
+    blockInfo.inode = null;
+    for(int idx = blockInfo.numNodes()-1; idx >= 0; idx--) {
+      DatanodeDescriptor dn = blockInfo.getDatanode(idx);
+      dn.removeBlock(blockInfo); // remove from the list and wipe the location
     }
+    map.remove(blockInfo);  // remove block from the map
   }
 
   /** Returns the block object it it exists in the map. */

Modified: hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSNamesystem.java?rev=670776&r1=670775&r2=670776&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSNamesystem.java (original)
+++ hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSNamesystem.java Mon
Jun 23 14:35:51 2008
@@ -1716,8 +1716,8 @@
     INodeFileUnderConstruction pendingFile = (INodeFileUnderConstruction)iFile;
 
     // Remove old block from blocks map. This always have to be done
-    // because the generationstamp of this block is changing.
-    blocksMap.remove(lastblock);
+    // because the generation stamp of this block is changing.
+    blocksMap.removeBlock(oldblockinfo);
 
     if (deleteblock) {
       pendingFile.removeBlock(lastblock);



Mime
View raw message