hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szets...@apache.org
Subject svn commit: r1154973 - in /hadoop/common/trunk/hdfs: CHANGES.txt src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java
Date Mon, 08 Aug 2011 14:27:54 GMT
Author: szetszwo
Date: Mon Aug  8 14:27:53 2011
New Revision: 1154973

URL: http://svn.apache.org/viewvc?rev=1154973&view=rev
Log:
HDFS-2238. In NamenodeFsck.toString(), uses StringBuilder.(..) instead of string concatenation.
 Contributed by Uma Maheswara Rao G

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

Modified: hadoop/common/trunk/hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hdfs/CHANGES.txt?rev=1154973&r1=1154972&r2=1154973&view=diff
==============================================================================
--- hadoop/common/trunk/hdfs/CHANGES.txt (original)
+++ hadoop/common/trunk/hdfs/CHANGES.txt Mon Aug  8 14:27:53 2011
@@ -644,6 +644,9 @@ Trunk (unreleased changes)
     HDFS-2228. Move block and datanode code from FSNamesystem to
     BlockManager and DatanodeManager.  (szetszwo)
 
+    HDFS-2238. In NamenodeFsck.toString(), uses StringBuilder.(..) instead of
+    string concatenation.  (Uma Maheswara Rao G via szetszwo)
+
   OPTIMIZATIONS
 
     HDFS-1458. Improve checkpoint performance by avoiding unnecessary image

Modified: hadoop/common/trunk/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java?rev=1154973&r1=1154972&r2=1154973&view=diff
==============================================================================
--- hadoop/common/trunk/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java
(original)
+++ hadoop/common/trunk/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java
Mon Aug  8 14:27:53 2011
@@ -646,46 +646,77 @@ public class NamenodeFsck {
     /** {@inheritDoc} */
     public String toString() {
       StringBuilder res = new StringBuilder();
-      res.append("Status: " + (isHealthy() ? "HEALTHY" : "CORRUPT"));
-      res.append("\n Total size:\t" + totalSize + " B");
-      if (totalOpenFilesSize != 0) 
-        res.append(" (Total open files size: " + totalOpenFilesSize + " B)");
-      res.append("\n Total dirs:\t" + totalDirs);
-      res.append("\n Total files:\t" + totalFiles);
-      if (totalOpenFiles != 0)
-        res.append(" (Files currently being written: " + 
-                   totalOpenFiles + ")");
-      res.append("\n Total blocks (validated):\t" + totalBlocks);
-      if (totalBlocks > 0) res.append(" (avg. block size "
-                                      + (totalSize / totalBlocks) + " B)");
-      if (totalOpenFilesBlocks != 0)
-        res.append(" (Total open file blocks (not validated): " + 
-                   totalOpenFilesBlocks + ")");
-      if (corruptFiles > 0) { 
-        res.append("\n  ********************************");
-        res.append("\n  CORRUPT FILES:\t" + corruptFiles);
+      res.append("Status: ").append((isHealthy() ? "HEALTHY" : "CORRUPT"))
+          .append("\n Total size:\t").append(totalSize).append(" B");
+      if (totalOpenFilesSize != 0) {
+        res.append(" (Total open files size: ").append(totalOpenFilesSize)
+            .append(" B)");
+      }
+      res.append("\n Total dirs:\t").append(totalDirs).append(
+          "\n Total files:\t").append(totalFiles);
+      if (totalOpenFiles != 0) {
+        res.append(" (Files currently being written: ").append(totalOpenFiles)
+            .append(")");
+      }
+      res.append("\n Total blocks (validated):\t").append(totalBlocks);
+      if (totalBlocks > 0) {
+        res.append(" (avg. block size ").append((totalSize / totalBlocks))
+            .append(" B)");
+      }
+      if (totalOpenFilesBlocks != 0) {
+        res.append(" (Total open file blocks (not validated): ").append(
+            totalOpenFilesBlocks).append(")");
+      }
+      if (corruptFiles > 0) {
+        res.append("\n  ********************************").append(
+            "\n  CORRUPT FILES:\t").append(corruptFiles);
         if (missingSize > 0) {
-          res.append("\n  MISSING BLOCKS:\t" + missingIds.size());
-          res.append("\n  MISSING SIZE:\t\t" + missingSize + " B");
+          res.append("\n  MISSING BLOCKS:\t").append(missingIds.size()).append(
+              "\n  MISSING SIZE:\t\t").append(missingSize).append(" B");
         }
         if (corruptBlocks > 0) {
-          res.append("\n  CORRUPT BLOCKS: \t" + corruptBlocks);
+          res.append("\n  CORRUPT BLOCKS: \t").append(corruptBlocks);
         }
         res.append("\n  ********************************");
       }
-      res.append("\n Minimally replicated blocks:\t" + numMinReplicatedBlocks);
-      if (totalBlocks > 0)        res.append(" (" + ((float) (numMinReplicatedBlocks *
100) / (float) totalBlocks) + " %)");
-      res.append("\n Over-replicated blocks:\t" + numOverReplicatedBlocks);
-      if (totalBlocks > 0)        res.append(" (" + ((float) (numOverReplicatedBlocks
* 100) / (float) totalBlocks) + " %)");
-      res.append("\n Under-replicated blocks:\t" + numUnderReplicatedBlocks);
-      if (totalBlocks > 0)        res.append(" (" + ((float) (numUnderReplicatedBlocks
* 100) / (float) totalBlocks) + " %)");
-      res.append("\n Mis-replicated blocks:\t\t" + numMisReplicatedBlocks);
-      if (totalBlocks > 0)        res.append(" (" + ((float) (numMisReplicatedBlocks *
100) / (float) totalBlocks) + " %)");
-      res.append("\n Default replication factor:\t" + replication);
-      res.append("\n Average block replication:\t" + getReplicationFactor());
-      res.append("\n Corrupt blocks:\t\t" + corruptBlocks);
-      res.append("\n Missing replicas:\t\t" + missingReplicas);
-      if (totalReplicas > 0)        res.append(" (" + ((float) (missingReplicas * 100)
/ (float) totalReplicas) + " %)");
+      res.append("\n Minimally replicated blocks:\t").append(
+          numMinReplicatedBlocks);
+      if (totalBlocks > 0) {
+        res.append(" (").append(
+            ((float) (numMinReplicatedBlocks * 100) / (float) totalBlocks))
+            .append(" %)");
+      }
+      res.append("\n Over-replicated blocks:\t")
+          .append(numOverReplicatedBlocks);
+      if (totalBlocks > 0) {
+        res.append(" (").append(
+            ((float) (numOverReplicatedBlocks * 100) / (float) totalBlocks))
+            .append(" %)");
+      }
+      res.append("\n Under-replicated blocks:\t").append(
+          numUnderReplicatedBlocks);
+      if (totalBlocks > 0) {
+        res.append(" (").append(
+            ((float) (numUnderReplicatedBlocks * 100) / (float) totalBlocks))
+            .append(" %)");
+      }
+      res.append("\n Mis-replicated blocks:\t\t")
+          .append(numMisReplicatedBlocks);
+      if (totalBlocks > 0) {
+        res.append(" (").append(
+            ((float) (numMisReplicatedBlocks * 100) / (float) totalBlocks))
+            .append(" %)");
+      }
+      res.append("\n Default replication factor:\t").append(replication)
+          .append("\n Average block replication:\t").append(
+              getReplicationFactor()).append("\n Corrupt blocks:\t\t").append(
+              corruptBlocks).append("\n Missing replicas:\t\t").append(
+              missingReplicas);
+      if (totalReplicas > 0) {
+        res.append(" (").append(
+            ((float) (missingReplicas * 100) / (float) totalReplicas)).append(
+            " %)");
+      }
       return res.toString();
     }
   }



Mime
View raw message