Browse Source

HADOOP-1139. Log HDFS block transitions at INFO level. Contributed by Dhruba.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@547416 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 years ago
parent
commit
0c4ae318f0

+ 3 - 0
CHANGES.txt

@@ -117,6 +117,9 @@ Trunk (unreleased changes)
  37. HADOOP-1467.  Remove redundant counters from WordCount example.
      (Owen O'Malley via tomwhite)
 
+ 38. HADOOP-1139.  Log HDFS block transitions at INFO level, to better
+     enable diagnosis of problems.  (Dhruba Borthakur via tomwhite)
+
 
 Release 0.13.0 - 2007-06-08
 

+ 13 - 15
src/java/org/apache/hadoop/dfs/FSNamesystem.java

@@ -938,9 +938,9 @@ class FSNamesystem implements FSConstants {
     FileUnderConstruction v = pendingCreates.get(src);
     v.getBlocks().add(b);
     pendingCreateBlocks.add(b);
-    NameNode.stateChangeLog.debug("BLOCK* NameSystem.allocateBlock: "
-                                  +src+ ". "+b.getBlockName()+
-                                  " is created and added to pendingCreates and pendingCreateBlocks");      
+    NameNode.stateChangeLog.info("BLOCK* NameSystem.allocateBlock: "
+                                 +src+ ". "+b.getBlockName()+
+                                 " is created and added to pendingCreates and pendingCreateBlocks");      
     return b;
   }
 
@@ -1033,7 +1033,7 @@ class FSNamesystem implements FSConstants {
     if (count > 1) {
       addToInvalidates(blk, dn);
       removeStoredBlock(blk, getDatanode(dn));
-      NameNode.stateChangeLog.info("BLOCK* NameSystem.invalidateBlocks: "
+      NameNode.stateChangeLog.debug("BLOCK* NameSystem.invalidateBlocks: "
                                    + blk.getBlockName() + " on " 
                                    + dn.getName() + " listed for deletion.");
     } else {
@@ -1084,7 +1084,7 @@ class FSNamesystem implements FSConstants {
                blocksMap.nodeIterator(b); it.hasNext();) {
           DatanodeDescriptor node = it.next();
           addToInvalidates(b, node);
-          NameNode.stateChangeLog.debug("BLOCK* NameSystem.delete: "
+          NameNode.stateChangeLog.info("BLOCK* NameSystem.delete: "
                                         + b.getBlockName() + " is added to invalidSet of " 
                                         + node.getName());
         }
@@ -2064,14 +2064,12 @@ class FSNamesystem implements FSConstants {
     if (added) {
       curReplicaDelta = 1;
       // 
-      // Hairong: I would prefer to set the level of next logrecord
-      // to be debug.
-      // But at startup time, because too many new blocks come in
-      // they simply take up all the space in the log file 
-      // So I set the level to be trace
+      // At startup time, because too many new blocks come in
+      // they take up lots of space in the log file. 
+      // So, we log only when namenode is out of safemode.
       //
-      if (NameNode.stateChangeLog.isTraceEnabled()) {
-        NameNode.stateChangeLog.trace("BLOCK* NameSystem.addStoredBlock: "
+      if (!isInSafeMode()) {
+        NameNode.stateChangeLog.info("BLOCK* NameSystem.addStoredBlock: "
                                       +"blockMap updated: "+node.getName()+" is added to "+block.getBlockName());
       }
     } else {
@@ -2429,15 +2427,15 @@ class FSNamesystem implements FSConstants {
       recentInvalidateSets.put(nodeID.getStorageID(), invalidateSet);
     }
         
-    if (NameNode.stateChangeLog.isDebugEnabled()) {
+    if (NameNode.stateChangeLog.isInfoEnabled()) {
       StringBuffer blockList = new StringBuffer();
       for (int i = 0; i < sendBlock.size(); i++) {
         blockList.append(' ');
         Block block = sendBlock.get(i);
         blockList.append(block.getBlockName());
       }
-      NameNode.stateChangeLog.debug("BLOCK* NameSystem.blockToInvalidate: "
-                                    +"ask "+nodeID.getName()+" to delete " + blockList);
+      NameNode.stateChangeLog.info("BLOCK* NameSystem.blockToInvalidate: "
+                                   +"ask "+nodeID.getName()+" to delete " + blockList);
     }
     return sendBlock.toArray(new Block[sendBlock.size()]);
   }

+ 1 - 1
src/java/org/apache/hadoop/dfs/NameNode.java

@@ -361,7 +361,7 @@ public class NameNode implements ClientProtocol, DatanodeProtocol, FSConstants {
    * check the blocks are actually corrupt. 
    */
   public void reportBadBlocks(LocatedBlock[] blocks) throws IOException {
-    stateChangeLog.debug("*DIR* NameNode.reportBadBlocks");
+    stateChangeLog.info("*DIR* NameNode.reportBadBlocks");
     for (int i = 0; i < blocks.length; i++) {
       Block blk = blocks[i].getBlock();
       DatanodeInfo[] nodes = blocks[i].getLocations();