You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by su...@apache.org on 2010/07/20 23:56:15 UTC

svn commit: r966031 - in /hadoop/hdfs/trunk: CHANGES.txt src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java

Author: suresh
Date: Tue Jul 20 21:56:15 2010
New Revision: 966031

URL: http://svn.apache.org/viewvc?rev=966031&view=rev
Log:
HDFS-1307 Add start time, end time and total time taken for FSCK to FSCK report. Contributed by Suresh Srinvias.

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

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=966031&r1=966030&r2=966031&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Tue Jul 20 21:56:15 2010
@@ -82,6 +82,9 @@ Trunk (unreleased changes)
     HDFS-1201. The HDFS component for HADOOP-6632. 
     (Kan Zhang & Jitendra Pandey via ddas)
     
+    HDFS-1307 Add start time, end time and total time taken for FSCK to 
+    FSCK report (suresh)
+    
 
   OPTIMIZATIONS
 

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java?rev=966031&r1=966030&r2=966031&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java Tue Jul 20 21:56:15 2010
@@ -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;
@@ -145,7 +146,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());
 
       final HdfsFileStatus file = namenode.getFileInfo(path);
       if (file != null) {
@@ -163,9 +166,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.
+        // string 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 {
@@ -179,6 +186,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 {