HBASE-11133 Add an option to skip snapshot verification after ExportSnapshot

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1593771 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
mbertozzi 2014-05-11 10:57:33 +00:00
parent 7f7ce73097
commit a56a4c900e
1 changed files with 11 additions and 4 deletions

View File

@ -685,6 +685,7 @@ public final class ExportSnapshot extends Configured implements Tool {
*/ */
@Override @Override
public int run(String[] args) throws IOException { public int run(String[] args) throws IOException {
boolean verifyTarget = true;
boolean verifyChecksum = true; boolean verifyChecksum = true;
String snapshotName = null; String snapshotName = null;
boolean overwrite = false; boolean overwrite = false;
@ -712,6 +713,8 @@ public final class ExportSnapshot extends Configured implements Tool {
FSUtils.setRootDir(conf, sourceDir); FSUtils.setRootDir(conf, sourceDir);
} else if (cmd.equals("-no-checksum-verify")) { } else if (cmd.equals("-no-checksum-verify")) {
verifyChecksum = false; verifyChecksum = false;
} else if (cmd.equals("-no-target-verify")) {
verifyTarget = false;
} else if (cmd.equals("-mappers")) { } else if (cmd.equals("-mappers")) {
mappers = Integer.parseInt(args[++i]); mappers = Integer.parseInt(args[++i]);
} else if (cmd.equals("-chuser")) { } else if (cmd.equals("-chuser")) {
@ -830,9 +833,11 @@ public final class ExportSnapshot extends Configured implements Tool {
} }
} }
// Step 4 - Verify snapshot validity // Step 4 - Verify snapshot integrity
LOG.info("Verify snapshot validity"); if (verifyTarget) {
verifySnapshot(conf, outputFs, outputRoot, outputSnapshotDir); LOG.info("Verify snapshot integrity");
verifySnapshot(conf, outputFs, outputRoot, outputSnapshotDir);
}
LOG.info("Export Completed: " + snapshotName); LOG.info("Export Completed: " + snapshotName);
return 0; return 0;
@ -854,7 +859,9 @@ public final class ExportSnapshot extends Configured implements Tool {
System.err.println(" -snapshot NAME Snapshot to restore."); System.err.println(" -snapshot NAME Snapshot to restore.");
System.err.println(" -copy-to NAME Remote destination hdfs://"); System.err.println(" -copy-to NAME Remote destination hdfs://");
System.err.println(" -copy-from NAME Input folder hdfs:// (default hbase.rootdir)"); System.err.println(" -copy-from NAME Input folder hdfs:// (default hbase.rootdir)");
System.err.println(" -no-checksum-verify Do not verify checksum."); System.err.println(" -no-checksum-verify Do not verify checksum, use name+length only.");
System.err.println(" -no-target-verify Do not verify the integrity of the \\" +
"exported snapshot.");
System.err.println(" -overwrite Rewrite the snapshot manifest if already exists"); System.err.println(" -overwrite Rewrite the snapshot manifest if already exists");
System.err.println(" -chuser USERNAME Change the owner of the files " + System.err.println(" -chuser USERNAME Change the owner of the files " +
"to the specified one."); "to the specified one.");