You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by mb...@apache.org on 2014/02/04 20:20:23 UTC

svn commit: r1564428 - /hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java

Author: mbertozzi
Date: Tue Feb  4 19:20:22 2014
New Revision: 1564428

URL: http://svn.apache.org/r1564428
Log:
HBASE-10457 Print corrupted file information in SnapshotInfo tool without -file option (Bharath Vissapragada)

Modified:
    hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java

Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java?rev=1564428&r1=1564427&r2=1564428&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java (original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java Tue Feb  4 19:20:22 2014
@@ -264,6 +264,7 @@ public final class SnapshotInfo extends 
           snapshotName = args[++i];
         } else if (cmd.equals("-files")) {
           showFiles = true;
+          showStats = true;
         } else if (cmd.equals("-stats")) {
           showStats = true;
         } else if (cmd.equals("-schema")) {
@@ -297,7 +298,7 @@ public final class SnapshotInfo extends 
 
     printInfo();
     if (showSchema) printSchema();
-    if (showFiles || showStats) printFiles(showFiles);
+    printFiles(showFiles, showStats);
 
     return 0;
   }
@@ -348,7 +349,7 @@ public final class SnapshotInfo extends 
    * Collect the hfiles and logs statistics of the snapshot and
    * dump the file list if requested and the collected information.
    */
-  private void printFiles(final boolean showFiles) throws IOException {
+  private void printFiles(final boolean showFiles, final boolean showStats) throws IOException {
     if (showFiles) {
       System.out.println("Snapshot Files");
       System.out.println("----------------------------------------");
@@ -403,15 +404,17 @@ public final class SnapshotInfo extends 
       System.out.println("**************************************************************");
     }
 
-    System.out.printf("%d HFiles (%d in archive), total size %s (%.2f%% %s shared with the source table)%n",
-      stats.getStoreFilesCount(), stats.getArchivedStoreFilesCount(),
-      StringUtils.humanReadableInt(stats.getStoreFilesSize()),
-      stats.getSharedStoreFilePercentage(),
-      StringUtils.humanReadableInt(stats.getSharedStoreFilesSize())
-    );
-    System.out.printf("%d Logs, total size %s%n",
-      stats.getLogsCount(), StringUtils.humanReadableInt(stats.getLogsSize()));
-    System.out.println();
+    if (showStats) {
+      System.out.printf("%d HFiles (%d in archive), total size %s (%.2f%% %s shared with the source table)%n",
+        stats.getStoreFilesCount(), stats.getArchivedStoreFilesCount(),
+        StringUtils.humanReadableInt(stats.getStoreFilesSize()),
+        stats.getSharedStoreFilePercentage(),
+        StringUtils.humanReadableInt(stats.getSharedStoreFilesSize())
+      );
+      System.out.printf("%d Logs, total size %s%n",
+        stats.getLogsCount(), StringUtils.humanReadableInt(stats.getLogsSize()));
+      System.out.println();
+    }
   }
 
   private void printUsageAndExit() {