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/07/03 07:21:09 UTC

[1/4] git commit: HBASE-11450 Improve file size info in SnapshotInfo tool

Repository: hbase
Updated Branches:
  refs/heads/0.94 83b4a1ee9 -> 0cc71fb2e
  refs/heads/0.98 1b2a05c94 -> 180034b75
  refs/heads/branch-1 3b2de6233 -> 39caf5757
  refs/heads/master ea085c637 -> c88b4c46a


HBASE-11450 Improve file size info in SnapshotInfo tool


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/0cc71fb2
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/0cc71fb2
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/0cc71fb2

Branch: refs/heads/0.94
Commit: 0cc71fb2e7e18b436bd6d01cabf6f0c4076d202d
Parents: 83b4a1e
Author: Matteo Bertozzi <ma...@cloudera.com>
Authored: Wed Jul 2 18:23:57 2014 +0200
Committer: Matteo Bertozzi <ma...@cloudera.com>
Committed: Wed Jul 2 18:23:57 2014 +0200

----------------------------------------------------------------------
 .../hadoop/hbase/snapshot/SnapshotInfo.java     | 31 +++++++++++++++-----
 1 file changed, 23 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/0cc71fb2/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java b/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
index b8ba593..fc416cd 100644
--- a/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
+++ b/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
@@ -100,6 +100,12 @@ public final class SnapshotInfo extends Configured implements Tool {
       public long getSize() {
         return this.size;
       }
+
+      String getStateToString() {
+        if (isMissing()) return "NOT FOUND";
+        if (inArchive()) return "archive";
+        return null;
+      }
     }
 
     private int hfileArchiveCount = 0;
@@ -247,6 +253,7 @@ public final class SnapshotInfo extends Configured implements Tool {
     }
   }
 
+  private boolean printSizeInBytes = false;
   private FileSystem fs;
   private Path rootDir;
 
@@ -283,6 +290,8 @@ public final class SnapshotInfo extends Configured implements Tool {
           FSUtils.setRootDir(conf, sourceDir);
         } else if (cmd.equals("-list-snapshots")) {
           listSnapshots = true;
+        } else if (cmd.equals("-size-in-bytes")) {
+          printSizeInBytes = true;
         } else if (cmd.equals("-h") || cmd.equals("--help")) {
           printUsageAndExit();
         } else {
@@ -392,10 +401,11 @@ public final class SnapshotInfo extends Configured implements Tool {
           SnapshotStats.FileInfo info = stats.addStoreFile(region, family, hfile);
 
           if (showFiles) {
+            String state = info.getStateToString();
             System.out.printf("%8s %s/%s/%s/%s %s%n",
-              (info.isMissing() ? "-" : StringUtils.humanReadableInt(info.getSize())),
+              (info.isMissing() ? "-" : fileSizeToString(info.getSize())),
               table, region, family, hfile,
-              (info.inArchive() ? "(archive)" : info.isMissing() ? "(NOT FOUND)" : ""));
+              state == null ? "" : "(" + state + ")");
           }
         }
 
@@ -405,7 +415,7 @@ public final class SnapshotInfo extends Configured implements Tool {
 
           if (showFiles) {
             System.out.printf("%8s recovered.edits %s on region %s%n",
-              StringUtils.humanReadableInt(info.getSize()), logfile, region);
+              fileSizeToString(info.getSize()), logfile, region);
           }
         }
 
@@ -414,10 +424,11 @@ public final class SnapshotInfo extends Configured implements Tool {
           SnapshotStats.FileInfo info = stats.addLogFile(server, logfile);
 
           if (showFiles) {
+            String state = info.getStateToString();
             System.out.printf("%8s log %s on server %s %s%n",
-              (info.isMissing() ? "-" : StringUtils.humanReadableInt(info.getSize())),
+              (info.isMissing() ? "-" : fileSizeToString(info.getSize())),
               logfile, server,
-              (info.isMissing() ? "(NOT FOUND)" : ""));
+              state == null ? "" : "(" + state + ")");
           }
         }
     });
@@ -434,16 +445,20 @@ public final class SnapshotInfo extends Configured implements Tool {
     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()),
+        fileSizeToString(stats.getStoreFilesSize()),
         stats.getSharedStoreFilePercentage(),
-        StringUtils.humanReadableInt(stats.getSharedStoreFilesSize())
+        fileSizeToString(stats.getSharedStoreFilesSize())
       );
       System.out.printf("%d Logs, total size %s%n",
-        stats.getLogsCount(), StringUtils.humanReadableInt(stats.getLogsSize()));
+        stats.getLogsCount(), fileSizeToString(stats.getLogsSize()));
       System.out.println();
     }
   }
 
+  private String fileSizeToString(long size) {
+    return printSizeInBytes ? Long.toString(size) : StringUtils.humanReadableInt(size);
+  }
+
   private void printUsageAndExit() {
     System.err.printf("Usage: bin/hbase %s [options]%n", getClass().getName());
     System.err.println(" where [options] are:");


[3/4] git commit: HBASE-11450 Improve file size info in SnapshotInfo tool

Posted by mb...@apache.org.
HBASE-11450 Improve file size info in SnapshotInfo tool


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/180034b7
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/180034b7
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/180034b7

Branch: refs/heads/0.98
Commit: 180034b755370d92945ba72bb0944be0140312ec
Parents: 1b2a05c
Author: Matteo Bertozzi <ma...@cloudera.com>
Authored: Wed Jul 2 18:33:09 2014 +0200
Committer: Matteo Bertozzi <ma...@cloudera.com>
Committed: Thu Jul 3 07:17:57 2014 +0200

----------------------------------------------------------------------
 .../hadoop/hbase/snapshot/SnapshotInfo.java     | 31 +++++++++++++++-----
 1 file changed, 23 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/180034b7/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
index 8017c0c..b11939f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
@@ -97,6 +97,12 @@ public final class SnapshotInfo extends Configured implements Tool {
       public long getSize() {
         return this.size;
       }
+
+      String getStateToString() {
+        if (isMissing()) return "NOT FOUND";
+        if (inArchive()) return "archive";
+        return null;
+      }
     }
 
     private int hfileArchiveCount = 0;
@@ -246,6 +252,7 @@ public final class SnapshotInfo extends Configured implements Tool {
     }
   }
 
+  private boolean printSizeInBytes = false;
   private FileSystem fs;
   private Path rootDir;
 
@@ -282,6 +289,8 @@ public final class SnapshotInfo extends Configured implements Tool {
           FSUtils.setRootDir(conf, sourceDir);
         } else if (cmd.equals("-list-snapshots")) {
           listSnapshots = true;
+        } else if (cmd.equals("-size-in-bytes")) {
+          printSizeInBytes = true;
         } else if (cmd.equals("-h") || cmd.equals("--help")) {
           printUsageAndExit();
         } else {
@@ -391,10 +400,11 @@ public final class SnapshotInfo extends Configured implements Tool {
           SnapshotStats.FileInfo info = stats.addStoreFile(region, family, hfile);
 
           if (showFiles) {
+            String state = info.getStateToString();
             System.out.printf("%8s %s/%s/%s/%s %s%n",
-              (info.isMissing() ? "-" : StringUtils.humanReadableInt(info.getSize())),
+              (info.isMissing() ? "-" : fileSizeToString(info.getSize())),
               table, region, family, hfile,
-              (info.inArchive() ? "(archive)" : info.isMissing() ? "(NOT FOUND)" : ""));
+              state == null ? "" : "(" + state + ")");
           }
         }
 
@@ -404,7 +414,7 @@ public final class SnapshotInfo extends Configured implements Tool {
 
           if (showFiles) {
             System.out.printf("%8s recovered.edits %s on region %s%n",
-              StringUtils.humanReadableInt(info.getSize()), logfile, region);
+              fileSizeToString(info.getSize()), logfile, region);
           }
         }
 
@@ -413,10 +423,11 @@ public final class SnapshotInfo extends Configured implements Tool {
           SnapshotStats.FileInfo info = stats.addLogFile(server, logfile);
 
           if (showFiles) {
+            String state = info.getStateToString();
             System.out.printf("%8s log %s on server %s %s%n",
-              (info.isMissing() ? "-" : StringUtils.humanReadableInt(info.getSize())),
+              (info.isMissing() ? "-" : fileSizeToString(info.getSize())),
               logfile, server,
-              (info.isMissing() ? "(NOT FOUND)" : ""));
+              state == null ? "" : "(" + state + ")");
           }
         }
     });
@@ -433,16 +444,20 @@ public final class SnapshotInfo extends Configured implements Tool {
     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()),
+        fileSizeToString(stats.getStoreFilesSize()),
         stats.getSharedStoreFilePercentage(),
-        StringUtils.humanReadableInt(stats.getSharedStoreFilesSize())
+        fileSizeToString(stats.getSharedStoreFilesSize())
       );
       System.out.printf("%d Logs, total size %s%n",
-        stats.getLogsCount(), StringUtils.humanReadableInt(stats.getLogsSize()));
+        stats.getLogsCount(), fileSizeToString(stats.getLogsSize()));
       System.out.println();
     }
   }
 
+  private String fileSizeToString(long size) {
+    return printSizeInBytes ? Long.toString(size) : StringUtils.humanReadableInt(size);
+  }
+
   private void printUsageAndExit() {
     System.err.printf("Usage: bin/hbase %s [options]%n", getClass().getName());
     System.err.println(" where [options] are:");


[2/4] git commit: HBASE-11450 Improve file size info in SnapshotInfo tool

Posted by mb...@apache.org.
HBASE-11450 Improve file size info in SnapshotInfo tool


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/39caf575
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/39caf575
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/39caf575

Branch: refs/heads/branch-1
Commit: 39caf5757d849333b05cebad0e4b3d4528c142d7
Parents: 3b2de62
Author: Matteo Bertozzi <ma...@cloudera.com>
Authored: Wed Jul 2 17:53:00 2014 +0200
Committer: Matteo Bertozzi <ma...@cloudera.com>
Committed: Thu Jul 3 07:17:40 2014 +0200

----------------------------------------------------------------------
 .../hadoop/hbase/snapshot/SnapshotInfo.java     | 61 ++++++++++++++++----
 1 file changed, 49 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/39caf575/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
index 749112a..de25394 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
@@ -77,10 +77,12 @@ public final class SnapshotInfo extends Configured implements Tool {
   public static class SnapshotStats {
     /** Information about the file referenced by the snapshot */
     static class FileInfo {
+      private final boolean corrupted;
       private final boolean inArchive;
       private final long size;
 
-      FileInfo(final boolean inArchive, final long size) {
+      FileInfo(final boolean inArchive, final long size, final boolean corrupted) {
+        this.corrupted = corrupted;
         this.inArchive = inArchive;
         this.size = size;
       }
@@ -90,6 +92,11 @@ public final class SnapshotInfo extends Configured implements Tool {
         return this.inArchive;
       }
 
+      /** @return true if the file is corrupted */
+      public boolean isCorrupted() {
+        return this.corrupted;
+      }
+
       /** @return true if the file is missing */
       public boolean isMissing() {
         return this.size < 0;
@@ -99,9 +106,17 @@ public final class SnapshotInfo extends Configured implements Tool {
       public long getSize() {
         return this.size;
       }
+
+      String getStateToString() {
+        if (isCorrupted()) return "CORRUPTED";
+        if (isMissing()) return "NOT FOUND";
+        if (inArchive()) return "archive";
+        return null;
+      }
     }
 
     private AtomicInteger hfileArchiveCount = new AtomicInteger();
+    private AtomicInteger hfilesCorrupted = new AtomicInteger();
     private AtomicInteger hfilesMissing = new AtomicInteger();
     private AtomicInteger hfilesCount = new AtomicInteger();
     private AtomicInteger logsMissing = new AtomicInteger();
@@ -130,7 +145,9 @@ public final class SnapshotInfo extends Configured implements Tool {
 
     /** @return true if the snapshot is corrupted */
     public boolean isSnapshotCorrupted() {
-      return hfilesMissing.get() > 0 || logsMissing.get() > 0;
+      return hfilesMissing.get() > 0 ||
+             logsMissing.get() > 0 ||
+             hfilesCorrupted.get() > 0;
     }
 
     /** @return the number of available store files */
@@ -153,6 +170,11 @@ public final class SnapshotInfo extends Configured implements Tool {
       return hfilesMissing.get();
     }
 
+    /** @return the number of corrupted store files */
+    public int getCorruptedStoreFilesCount() {
+      return hfilesCorrupted.get();
+    }
+
     /** @return the number of missing log files */
     public int getMissingLogsCount() {
       return logsMissing.get();
@@ -194,6 +216,7 @@ public final class SnapshotInfo extends Configured implements Tool {
         final SnapshotRegionManifest.StoreFile storeFile) throws IOException {
       HFileLink link = HFileLink.create(conf, snapshotTable, region.getEncodedName(),
                                         family, storeFile.getName());
+      boolean isCorrupted = false;
       boolean inArchive = false;
       long size = -1;
       try {
@@ -206,10 +229,12 @@ public final class SnapshotInfo extends Configured implements Tool {
           hfileSize.addAndGet(size);
           hfilesCount.incrementAndGet();
         }
+        isCorrupted = (storeFile.hasFileSize() && storeFile.getFileSize() != size);
+        if (isCorrupted) hfilesCorrupted.incrementAndGet();
       } catch (FileNotFoundException e) {
         hfilesMissing.incrementAndGet();
       }
-      return new FileInfo(inArchive, size);
+      return new FileInfo(inArchive, size, isCorrupted);
     }
 
     /**
@@ -228,10 +253,11 @@ public final class SnapshotInfo extends Configured implements Tool {
       } catch (FileNotFoundException e) {
         logsMissing.incrementAndGet();
       }
-      return new FileInfo(false, size);
+      return new FileInfo(false, size, false);
     }
   }
 
+  private boolean printSizeInBytes = false;
   private FileSystem fs;
   private Path rootDir;
 
@@ -266,6 +292,8 @@ public final class SnapshotInfo extends Configured implements Tool {
           FSUtils.setRootDir(conf, sourceDir);
         } else if (cmd.equals("-list-snapshots")) {
           listSnapshots = true;
+        } else if (cmd.equals("-size-in-bytes")) {
+          printSizeInBytes = true;
         } else if (cmd.equals("-h") || cmd.equals("--help")) {
           printUsageAndExit();
         } else {
@@ -379,10 +407,11 @@ public final class SnapshotInfo extends Configured implements Tool {
 
           SnapshotStats.FileInfo info = stats.addStoreFile(regionInfo, family, storeFile);
           if (showFiles) {
+            String state = info.getStateToString();
             System.out.printf("%8s %s/%s/%s/%s %s%n",
-              (info.isMissing() ? "-" : StringUtils.humanReadableInt(info.getSize())),
+              (info.isMissing() ? "-" : fileSizeToString(info.getSize())),
               table, regionInfo.getEncodedName(), family, storeFile.getName(),
-              (info.inArchive() ? "(archive)" : info.isMissing() ? "(NOT FOUND)" : ""));
+              state == null ? "" : "(" + state + ")");
           }
         }
 
@@ -392,10 +421,11 @@ public final class SnapshotInfo extends Configured implements Tool {
           SnapshotStats.FileInfo info = stats.addLogFile(server, logfile);
 
           if (showFiles) {
-            System.out.printf("%8s log %s on server %s %s%n",
-              (info.isMissing() ? "-" : StringUtils.humanReadableInt(info.getSize())),
+            String state = info.getStateToString();
+            System.out.printf("%8s log %s on server %s (%s)%n",
+              (info.isMissing() ? "-" : fileSizeToString(info.getSize())),
               logfile, server,
-              (info.isMissing() ? "(NOT FOUND)" : ""));
+              state == null ? "" : "(" + state + ")");
           }
         }
     });
@@ -406,28 +436,35 @@ public final class SnapshotInfo extends Configured implements Tool {
       System.out.println("**************************************************************");
       System.out.printf("BAD SNAPSHOT: %d hfile(s) and %d log(s) missing.%n",
         stats.getMissingStoreFilesCount(), stats.getMissingLogsCount());
+      System.out.printf("              %d hfile(s) corrupted.%n",
+        stats.getCorruptedStoreFilesCount());
       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()),
+        fileSizeToString(stats.getStoreFilesSize()),
         stats.getSharedStoreFilePercentage(),
-        StringUtils.humanReadableInt(stats.getSharedStoreFilesSize())
+        fileSizeToString(stats.getSharedStoreFilesSize())
       );
       System.out.printf("%d Logs, total size %s%n",
-        stats.getLogsCount(), StringUtils.humanReadableInt(stats.getLogsSize()));
+        stats.getLogsCount(), fileSizeToString(stats.getLogsSize()));
       System.out.println();
     }
   }
 
+  private String fileSizeToString(long size) {
+    return printSizeInBytes ? Long.toString(size) : StringUtils.humanReadableInt(size);
+  }
+
   private void printUsageAndExit() {
     System.err.printf("Usage: bin/hbase %s [options]%n", getClass().getName());
     System.err.println(" where [options] are:");
     System.err.println("  -h|-help                Show this help and exit.");
     System.err.println("  -remote-dir             Root directory that contains the snapshots.");
     System.err.println("  -list-snapshots         List all the available snapshots and exit.");
+    System.err.println("  -size-in-bytes          Print the size of the files in bytes.");
     System.err.println("  -snapshot NAME          Snapshot to examine.");
     System.err.println("  -files                  Files and logs list.");
     System.err.println("  -stats                  Files and logs stats.");


[4/4] git commit: HBASE-11450 Improve file size info in SnapshotInfo tool

Posted by mb...@apache.org.
HBASE-11450 Improve file size info in SnapshotInfo tool


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/c88b4c46
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/c88b4c46
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/c88b4c46

Branch: refs/heads/master
Commit: c88b4c46a40ad8bfd29640395aee12a566080e86
Parents: ea085c6
Author: Matteo Bertozzi <ma...@cloudera.com>
Authored: Wed Jul 2 17:53:00 2014 +0200
Committer: Matteo Bertozzi <ma...@cloudera.com>
Committed: Thu Jul 3 07:19:00 2014 +0200

----------------------------------------------------------------------
 .../hadoop/hbase/snapshot/SnapshotInfo.java     | 61 ++++++++++++++++----
 1 file changed, 49 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/c88b4c46/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
index 749112a..de25394 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotInfo.java
@@ -77,10 +77,12 @@ public final class SnapshotInfo extends Configured implements Tool {
   public static class SnapshotStats {
     /** Information about the file referenced by the snapshot */
     static class FileInfo {
+      private final boolean corrupted;
       private final boolean inArchive;
       private final long size;
 
-      FileInfo(final boolean inArchive, final long size) {
+      FileInfo(final boolean inArchive, final long size, final boolean corrupted) {
+        this.corrupted = corrupted;
         this.inArchive = inArchive;
         this.size = size;
       }
@@ -90,6 +92,11 @@ public final class SnapshotInfo extends Configured implements Tool {
         return this.inArchive;
       }
 
+      /** @return true if the file is corrupted */
+      public boolean isCorrupted() {
+        return this.corrupted;
+      }
+
       /** @return true if the file is missing */
       public boolean isMissing() {
         return this.size < 0;
@@ -99,9 +106,17 @@ public final class SnapshotInfo extends Configured implements Tool {
       public long getSize() {
         return this.size;
       }
+
+      String getStateToString() {
+        if (isCorrupted()) return "CORRUPTED";
+        if (isMissing()) return "NOT FOUND";
+        if (inArchive()) return "archive";
+        return null;
+      }
     }
 
     private AtomicInteger hfileArchiveCount = new AtomicInteger();
+    private AtomicInteger hfilesCorrupted = new AtomicInteger();
     private AtomicInteger hfilesMissing = new AtomicInteger();
     private AtomicInteger hfilesCount = new AtomicInteger();
     private AtomicInteger logsMissing = new AtomicInteger();
@@ -130,7 +145,9 @@ public final class SnapshotInfo extends Configured implements Tool {
 
     /** @return true if the snapshot is corrupted */
     public boolean isSnapshotCorrupted() {
-      return hfilesMissing.get() > 0 || logsMissing.get() > 0;
+      return hfilesMissing.get() > 0 ||
+             logsMissing.get() > 0 ||
+             hfilesCorrupted.get() > 0;
     }
 
     /** @return the number of available store files */
@@ -153,6 +170,11 @@ public final class SnapshotInfo extends Configured implements Tool {
       return hfilesMissing.get();
     }
 
+    /** @return the number of corrupted store files */
+    public int getCorruptedStoreFilesCount() {
+      return hfilesCorrupted.get();
+    }
+
     /** @return the number of missing log files */
     public int getMissingLogsCount() {
       return logsMissing.get();
@@ -194,6 +216,7 @@ public final class SnapshotInfo extends Configured implements Tool {
         final SnapshotRegionManifest.StoreFile storeFile) throws IOException {
       HFileLink link = HFileLink.create(conf, snapshotTable, region.getEncodedName(),
                                         family, storeFile.getName());
+      boolean isCorrupted = false;
       boolean inArchive = false;
       long size = -1;
       try {
@@ -206,10 +229,12 @@ public final class SnapshotInfo extends Configured implements Tool {
           hfileSize.addAndGet(size);
           hfilesCount.incrementAndGet();
         }
+        isCorrupted = (storeFile.hasFileSize() && storeFile.getFileSize() != size);
+        if (isCorrupted) hfilesCorrupted.incrementAndGet();
       } catch (FileNotFoundException e) {
         hfilesMissing.incrementAndGet();
       }
-      return new FileInfo(inArchive, size);
+      return new FileInfo(inArchive, size, isCorrupted);
     }
 
     /**
@@ -228,10 +253,11 @@ public final class SnapshotInfo extends Configured implements Tool {
       } catch (FileNotFoundException e) {
         logsMissing.incrementAndGet();
       }
-      return new FileInfo(false, size);
+      return new FileInfo(false, size, false);
     }
   }
 
+  private boolean printSizeInBytes = false;
   private FileSystem fs;
   private Path rootDir;
 
@@ -266,6 +292,8 @@ public final class SnapshotInfo extends Configured implements Tool {
           FSUtils.setRootDir(conf, sourceDir);
         } else if (cmd.equals("-list-snapshots")) {
           listSnapshots = true;
+        } else if (cmd.equals("-size-in-bytes")) {
+          printSizeInBytes = true;
         } else if (cmd.equals("-h") || cmd.equals("--help")) {
           printUsageAndExit();
         } else {
@@ -379,10 +407,11 @@ public final class SnapshotInfo extends Configured implements Tool {
 
           SnapshotStats.FileInfo info = stats.addStoreFile(regionInfo, family, storeFile);
           if (showFiles) {
+            String state = info.getStateToString();
             System.out.printf("%8s %s/%s/%s/%s %s%n",
-              (info.isMissing() ? "-" : StringUtils.humanReadableInt(info.getSize())),
+              (info.isMissing() ? "-" : fileSizeToString(info.getSize())),
               table, regionInfo.getEncodedName(), family, storeFile.getName(),
-              (info.inArchive() ? "(archive)" : info.isMissing() ? "(NOT FOUND)" : ""));
+              state == null ? "" : "(" + state + ")");
           }
         }
 
@@ -392,10 +421,11 @@ public final class SnapshotInfo extends Configured implements Tool {
           SnapshotStats.FileInfo info = stats.addLogFile(server, logfile);
 
           if (showFiles) {
-            System.out.printf("%8s log %s on server %s %s%n",
-              (info.isMissing() ? "-" : StringUtils.humanReadableInt(info.getSize())),
+            String state = info.getStateToString();
+            System.out.printf("%8s log %s on server %s (%s)%n",
+              (info.isMissing() ? "-" : fileSizeToString(info.getSize())),
               logfile, server,
-              (info.isMissing() ? "(NOT FOUND)" : ""));
+              state == null ? "" : "(" + state + ")");
           }
         }
     });
@@ -406,28 +436,35 @@ public final class SnapshotInfo extends Configured implements Tool {
       System.out.println("**************************************************************");
       System.out.printf("BAD SNAPSHOT: %d hfile(s) and %d log(s) missing.%n",
         stats.getMissingStoreFilesCount(), stats.getMissingLogsCount());
+      System.out.printf("              %d hfile(s) corrupted.%n",
+        stats.getCorruptedStoreFilesCount());
       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()),
+        fileSizeToString(stats.getStoreFilesSize()),
         stats.getSharedStoreFilePercentage(),
-        StringUtils.humanReadableInt(stats.getSharedStoreFilesSize())
+        fileSizeToString(stats.getSharedStoreFilesSize())
       );
       System.out.printf("%d Logs, total size %s%n",
-        stats.getLogsCount(), StringUtils.humanReadableInt(stats.getLogsSize()));
+        stats.getLogsCount(), fileSizeToString(stats.getLogsSize()));
       System.out.println();
     }
   }
 
+  private String fileSizeToString(long size) {
+    return printSizeInBytes ? Long.toString(size) : StringUtils.humanReadableInt(size);
+  }
+
   private void printUsageAndExit() {
     System.err.printf("Usage: bin/hbase %s [options]%n", getClass().getName());
     System.err.println(" where [options] are:");
     System.err.println("  -h|-help                Show this help and exit.");
     System.err.println("  -remote-dir             Root directory that contains the snapshots.");
     System.err.println("  -list-snapshots         List all the available snapshots and exit.");
+    System.err.println("  -size-in-bytes          Print the size of the files in bytes.");
     System.err.println("  -snapshot NAME          Snapshot to examine.");
     System.err.println("  -files                  Files and logs list.");
     System.err.println("  -stats                  Files and logs stats.");