You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ec...@apache.org on 2014/10/15 19:44:30 UTC

git commit: HBASE-12271 Add counters for files skipped during snapshot export

Repository: hbase
Updated Branches:
  refs/heads/master f9c534bac -> ba20d4df8


HBASE-12271 Add counters for files skipped during snapshot export

Add counters for skipped files

Signed-off-by: Elliott Clark <ec...@apache.org>


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

Branch: refs/heads/master
Commit: ba20d4df8ced17e175d6a1d57982559d4dce79cd
Parents: f9c534b
Author: Patrick White <pw...@fb.com>
Authored: Thu Oct 9 12:41:35 2014 -0700
Committer: Elliott Clark <ec...@apache.org>
Committed: Wed Oct 15 10:41:48 2014 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/snapshot/ExportSnapshot.java | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ba20d4df/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java
index 59cd9e7..51dac3c 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java
@@ -113,7 +113,10 @@ public class ExportSnapshot extends Configured implements Tool {
   private static final String INPUT_FOLDER_PREFIX = "export-files.";
 
   // Export Map-Reduce Counters, to keep track of the progress
-  public enum Counter { MISSING_FILES, COPY_FAILED, BYTES_EXPECTED, BYTES_COPIED, FILES_COPIED };
+  public enum Counter {
+    MISSING_FILES, FILES_COPIED, FILES_SKIPPED, COPY_FAILED,
+    BYTES_EXPECTED, BYTES_SKIPPED, BYTES_COPIED
+  }
 
   private static class ExportMapper extends Mapper<BytesWritable, NullWritable,
                                                    NullWritable, NullWritable> {
@@ -169,6 +172,10 @@ public class ExportSnapshot extends Configured implements Tool {
       int defaultBlockSize = Math.max((int) outputFs.getDefaultBlockSize(outputRoot), BUFFER_SIZE);
       bufferSize = conf.getInt(CONF_BUFFER_SIZE, defaultBlockSize);
       LOG.info("Using bufferSize=" + StringUtils.humanReadableInt(bufferSize));
+
+      for (Counter c : Counter.values()) {
+        context.getCounter(c).increment(0);
+      }
     }
 
     @Override
@@ -242,6 +249,8 @@ public class ExportSnapshot extends Configured implements Tool {
         FileStatus outputStat = outputFs.getFileStatus(outputPath);
         if (outputStat != null && sameFile(inputStat, outputStat)) {
           LOG.info("Skip copy " + inputStat.getPath() + " to " + outputPath + ", same file.");
+          context.getCounter(Counter.FILES_SKIPPED).increment(1);
+          context.getCounter(Counter.BYTES_SKIPPED).increment(inputStat.getLen());
           return;
         }
       }