HBASE-12271 Add counters for files skipped during snapshot export
Add counters for skipped files Signed-off-by: Elliott Clark <eclark@apache.org>
This commit is contained in:
parent
5ca2e4c716
commit
c68c17ffec
|
@ -113,7 +113,10 @@ public class ExportSnapshot extends Configured implements Tool {
|
||||||
private static final String INPUT_FOLDER_PREFIX = "export-files.";
|
private static final String INPUT_FOLDER_PREFIX = "export-files.";
|
||||||
|
|
||||||
// Export Map-Reduce Counters, to keep track of the progress
|
// 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,
|
private static class ExportMapper extends Mapper<BytesWritable, NullWritable,
|
||||||
NullWritable, NullWritable> {
|
NullWritable, NullWritable> {
|
||||||
|
@ -169,6 +172,10 @@ public class ExportSnapshot extends Configured implements Tool {
|
||||||
int defaultBlockSize = Math.max((int) outputFs.getDefaultBlockSize(outputRoot), BUFFER_SIZE);
|
int defaultBlockSize = Math.max((int) outputFs.getDefaultBlockSize(outputRoot), BUFFER_SIZE);
|
||||||
bufferSize = conf.getInt(CONF_BUFFER_SIZE, defaultBlockSize);
|
bufferSize = conf.getInt(CONF_BUFFER_SIZE, defaultBlockSize);
|
||||||
LOG.info("Using bufferSize=" + StringUtils.humanReadableInt(bufferSize));
|
LOG.info("Using bufferSize=" + StringUtils.humanReadableInt(bufferSize));
|
||||||
|
|
||||||
|
for (Counter c : Counter.values()) {
|
||||||
|
context.getCounter(c).increment(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -242,6 +249,8 @@ public class ExportSnapshot extends Configured implements Tool {
|
||||||
FileStatus outputStat = outputFs.getFileStatus(outputPath);
|
FileStatus outputStat = outputFs.getFileStatus(outputPath);
|
||||||
if (outputStat != null && sameFile(inputStat, outputStat)) {
|
if (outputStat != null && sameFile(inputStat, outputStat)) {
|
||||||
LOG.info("Skip copy " + inputStat.getPath() + " to " + outputPath + ", same file.");
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue