hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hair...@apache.org
Subject svn commit: r761482 - in /hadoop/core/trunk: CHANGES.txt src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
Date Thu, 02 Apr 2009 23:53:59 GMT
Author: hairong
Date: Thu Apr  2 23:53:59 2009
New Revision: 761482

URL: http://svn.apache.org/viewvc?rev=761482&view=rev
Log:
HADOOP-5605. All the replicas incorrectly got marked as corrupt. Contributed by Hairong Kuang.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=761482&r1=761481&r2=761482&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Thu Apr  2 23:53:59 2009
@@ -1176,6 +1176,8 @@
 
     HADOOP-5607. Fix NPE in TestCapacityScheduler. (cdouglas)
 
+    HADOOP-5605. All the replicas incorrectly got marked as corrupt. (hairong)
+
 Release 0.19.2 - Unreleased
 
   BUG FIXES

Modified: hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=761482&r1=761481&r2=761482&view=diff
==============================================================================
--- hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java (original)
+++ hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java Thu
Apr  2 23:53:59 2009
@@ -1582,7 +1582,8 @@
                             " does not exist. ");
     }
     
-    if (!blocksMap.contains(blk, node)) {
+    final BlockInfo storedBlockInfo = blocksMap.getStoredBlock(blk);
+    if (storedBlockInfo == null) {
       // Check if the replica is in the blockMap, if not 
       // ignore the request for now. This could happen when BlockScanner
       // thread of Datanode reports bad block before Block reports are sent
@@ -1592,16 +1593,23 @@
                                    "as corrupt as it does not exists in " +
                                    "blocksMap");
     } else {
-      INodeFile inode = blocksMap.getINode(blk);
-      assert inode!=null : (blk + " in blocksMap must belongs to a file.");
+      INodeFile inode = storedBlockInfo.getINode();
+      if (inode == null) {
+        NameNode.stateChangeLog.info("BLOCK NameSystem.markBlockAsCorrupt: " +
+                                     "block " + blk + " could not be marked " +
+                                     "as corrupt as it does not belong to " +
+                                     "any file");
+        addToInvalidates(storedBlockInfo, node);
+        return;
+      } 
       // Add this replica to corruptReplicas Map 
-      corruptReplicas.addToCorruptReplicasMap(blk, node);
-      if (countNodes(blk).liveReplicas()>inode.getReplication()) {
+      corruptReplicas.addToCorruptReplicasMap(storedBlockInfo, node);
+      if (countNodes(storedBlockInfo).liveReplicas()>inode.getReplication()) {
         // the block is over-replicated so invalidate the replicas immediately
-        invalidateBlock(blk, node);
+        invalidateBlock(storedBlockInfo, node);
       } else {
         // add the block to neededReplication 
-        updateNeededReplications(blk, -1, 0);
+        updateNeededReplications(storedBlockInfo, -1, 0);
       }
     }
   }



Mime
View raw message