You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/04 05:30:14 UTC

svn commit: r1077570 - /hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java

Author: omalley
Date: Fri Mar  4 04:30:13 2011
New Revision: 1077570

URL: http://svn.apache.org/viewvc?rev=1077570&view=rev
Log:
commit d6014a0923080a16bda912410f1bc2b720da84e7
Author: Suresh Srinivas <su...@yahoo-inc.com>
Date:   Tue Jul 20 16:05:44 2010 -0700

    src/hdfs/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java
    
    +++ b/YAHOO-CHANGES.txt
    +    HDFS-1307 Add start time, end time and total time taken for FSCK
    +    to FSCK report. (suresh)

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java

Modified: hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java?rev=1077570&r1=1077569&r2=1077570&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java Fri Mar  4 04:30:13 2011
@@ -23,6 +23,7 @@ import java.io.PrintWriter;
 import java.net.InetSocketAddress;
 import java.net.Socket;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -137,7 +138,9 @@ public class NamenodeFsck {
    * Check files on DFS, starting from the indicated path.
    */
   public void fsck() {
+    final long startTime = System.currentTimeMillis();
     try {
+      out.println("Namenode FSCK started at " + new Date());
       Result res = new Result(conf);
       final HdfsFileStatus file = namenode.getFileInfo(path);
       if (file != null) {
@@ -147,9 +150,13 @@ public class NamenodeFsck {
         out.println(" Number of data-nodes:\t\t" + totalDatanodes);
         out.println(" Number of racks:\t\t" + networktopology.getNumOfRacks());
 
+        out.println("FSCK ended at " + new Date() + " in "
+            + (System.currentTimeMillis() - startTime + " milliseconds"));
+
         // DFSck client scans for the string HEALTHY/CORRUPT to check the status
         // of file system and return appropriate code. Changing the output string
-        // might break testcases. 
+        // might break testcases. Also note this must be the last line 
+        // of the report.
         if (res.isHealthy()) {
           out.print("\n\nThe filesystem under path '" + path + "' " + HEALTHY_STATUS);
         }  else {
@@ -161,6 +168,8 @@ public class NamenodeFsck {
     } catch (Exception e) {
       String errMsg = "Fsck on path '" + path + "' " + FAILURE_STATUS;
       LOG.warn(errMsg, e);
+      out.println("FSCK ended at " + new Date() + " in "
+          + (System.currentTimeMillis() - startTime + " milliseconds"));
       out.println(e.getMessage());
       out.print("\n\n"+errMsg);
     } finally {