@@ -141,6 +141,8 @@ static final class Options {
141141 "Do not verify checksum, use name+length only." );
142142 static final Option NO_TARGET_VERIFY = new Option (null , "no-target-verify" , false ,
143143 "Do not verify the integrity of the exported snapshot." );
144+ static final Option NO_SOURCE_VERIFY = new Option (null , "no-source-verify" , false ,
145+ "Do not verify the source of the snapshot." );
144146 static final Option OVERWRITE = new Option (null , "overwrite" , false ,
145147 "Rewrite the snapshot manifest if already exists." );
146148 static final Option CHUSER = new Option (null , "chuser" , true ,
@@ -903,6 +905,7 @@ private void setPermissionParallel(final FileSystem outputFs, final short filesM
903905 }
904906
905907 private boolean verifyTarget = true ;
908+ private boolean verifySource = true ;
906909 private boolean verifyChecksum = true ;
907910 private String snapshotName = null ;
908911 private String targetName = null ;
@@ -934,6 +937,7 @@ protected void processOptions(CommandLine cmd) {
934937 // And verifyChecksum and verifyTarget with values read from old args in processOldArgs(...).
935938 verifyChecksum = !cmd .hasOption (Options .NO_CHECKSUM_VERIFY .getLongOpt ());
936939 verifyTarget = !cmd .hasOption (Options .NO_TARGET_VERIFY .getLongOpt ());
940+ verifySource = !cmd .hasOption (Options .NO_SOURCE_VERIFY .getLongOpt ());
937941 }
938942
939943 /**
@@ -984,6 +988,13 @@ public int doWork() throws IOException {
984988 LOG .debug ("outputFs={}, outputRoot={}, skipTmp={}, initialOutputSnapshotDir={}" ,
985989 outputFs , outputRoot .toString (), skipTmp , initialOutputSnapshotDir );
986990
991+ // Verify snapshot source before copying files
992+ if (verifySource ) {
993+ LOG .info ("Verify snapshot source, inputFs={}, inputRoot={}, snapshotDir={}." ,
994+ inputFs .getUri (), inputRoot , snapshotDir );
995+ verifySnapshot (srcConf , inputFs , inputRoot , snapshotDir );
996+ }
997+
987998 // Find the necessary directory which need to change owner and group
988999 Path needSetOwnerDir = SnapshotDescriptionUtils .getSnapshotRootDir (outputRoot );
9891000 if (outputFs .exists (needSetOwnerDir )) {
@@ -1134,6 +1145,7 @@ protected void printUsage() {
11341145 addOption (Options .TARGET_NAME );
11351146 addOption (Options .NO_CHECKSUM_VERIFY );
11361147 addOption (Options .NO_TARGET_VERIFY );
1148+ addOption (Options .NO_SOURCE_VERIFY );
11371149 addOption (Options .OVERWRITE );
11381150 addOption (Options .CHUSER );
11391151 addOption (Options .CHGROUP );
0 commit comments