HBASE-17347 ExportSnapshot may write snapshot info file to wrong directory when specifying target name (Jianwei Cui)

This commit is contained in:
tedyu 2016-12-20 13:02:51 -08:00
parent e75dee3a21
commit 5ebb25d601
1 changed files with 9 additions and 1 deletions

View File

@ -1035,7 +1035,15 @@ public class ExportSnapshot extends AbstractHBaseTool implements Tool {
.toBuilder()
.setName(targetName)
.build();
SnapshotDescriptionUtils.writeSnapshotInfo(snapshotDesc, snapshotTmpDir, outputFs);
SnapshotDescriptionUtils.writeSnapshotInfo(snapshotDesc, initialOutputSnapshotDir, outputFs);
if (filesUser != null || filesGroup != null) {
outputFs.setOwner(new Path(initialOutputSnapshotDir,
SnapshotDescriptionUtils.SNAPSHOTINFO_FILE), filesUser, filesGroup);
}
if (filesMode > 0) {
outputFs.setPermission(new Path(initialOutputSnapshotDir,
SnapshotDescriptionUtils.SNAPSHOTINFO_FILE), new FsPermission((short)filesMode));
}
}
// Step 2 - Start MR Job to copy files