hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r650765 - in /hadoop/core/trunk: CHANGES.txt src/java/org/apache/hadoop/dfs/DFSck.java src/java/org/apache/hadoop/dfs/NamenodeFsck.java
Date Wed, 23 Apr 2008 07:04:37 GMT
Author: omalley
Date: Wed Apr 23 00:04:36 2008
New Revision: 650765

URL: http://svn.apache.org/viewvc?rev=650765&view=rev
Log:
HADOOP-1979. Speed up fsck by adding a buffered stream. Contributed by Lohit
Vijaya Renu.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSck.java
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=650765&r1=650764&r2=650765&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Wed Apr 23 00:04:36 2008
@@ -39,6 +39,9 @@
     HADOOP-3272. Remove redundant copy of Block object in BlocksMap.
     (Lohit Vjayarenu via shv)
 
+    HADOOP-1979. Speed up fsck by adding a buffered stream. (Lohit
+    Vijaya Renu via omalley)
+
   BUG FIXES
 
     HADOOP-2905. 'fsck -move' triggers NPE in NameNode. 

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSck.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSck.java?rev=650765&r1=650764&r2=650765&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSck.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/DFSck.java Wed Apr 23 00:04:36 2008
@@ -20,6 +20,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.io.BufferedReader;
 import java.net.URL;
 import java.net.URLConnection;
 import java.net.URLEncoder;
@@ -113,13 +114,12 @@
     URL path = new URL(url.toString());
     URLConnection connection = path.openConnection();
     InputStream stream = connection.getInputStream();
-    InputStreamReader input =
-      new InputStreamReader(stream, "UTF-8");
+    BufferedReader input = new BufferedReader(new InputStreamReader(
+                                              stream, "UTF-8"));
+    String line = null;
     try {
-      int c = input.read();
-      while (c != -1) {
-        System.out.print((char) c);
-        c = input.read();
+      while ((line = input.readLine()) != null) {
+        System.out.println(line);
       }
     } finally {
       input.close();

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java?rev=650765&r1=650764&r2=650765&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/NamenodeFsck.java Wed Apr 23 00:04:36
2008
@@ -181,9 +181,8 @@
         blocks.locatedBlockCount() + " block(s): ");
     } else {
       out.print('.');
-      out.flush();
-      if (res.totalFiles % 100 == 0) { out.println(); }
     }
+    if (res.totalFiles % 100 == 0) { out.flush(); }
     int missing = 0;
     long missize = 0;
     int underReplicatedPerFile = 0;
@@ -256,7 +255,7 @@
     }
     if (missing > 0) {
       if (!showFiles) {
-        out.println("\n" + path + ": MISSING " + missing
+        out.print("\n" + path + ": MISSING " + missing
             + " blocks of total size " + missize + " B.");
       }
       res.corruptFiles++;
@@ -274,12 +273,12 @@
     }
     if (showFiles) {
       if (missing > 0) {
-        out.println(" MISSING " + missing + " blocks of total size " + missize + " B");
+        out.print(" MISSING " + missing + " blocks of total size " + missize + " B\n");
       }  else if (underReplicatedPerFile == 0 && misReplicatedPerFile == 0) {
-        out.println(" OK");
+        out.print(" OK\n");
       }
       if (showBlocks) {
-        out.println(report.toString());
+        out.print(report.toString() + "\n");
       }
     }
   }



Mime
View raw message