HBASE-20668 Avoid permission change if ExportSnapshot's copy fails
This commit is contained in:
parent
a11701ecc5
commit
74ef118e9e
|
@ -1027,15 +1027,18 @@ public class ExportSnapshot extends AbstractHBaseTool implements Tool {
|
|||
// The snapshot references must be copied before the hfiles otherwise the cleaner
|
||||
// will remove them because they are unreferenced.
|
||||
List<Path> travesedPaths = new ArrayList<>();
|
||||
boolean copySucceeded = false;
|
||||
try {
|
||||
LOG.info("Copy Snapshot Manifest");
|
||||
LOG.info("Copy Snapshot Manifest from " + snapshotDir + " to " + initialOutputSnapshotDir);
|
||||
travesedPaths =
|
||||
FSUtils.copyFilesParallel(inputFs, snapshotDir, outputFs, initialOutputSnapshotDir, conf,
|
||||
conf.getInt(CONF_COPY_MANIFEST_THREADS, DEFAULT_COPY_MANIFEST_THREADS));
|
||||
copySucceeded = true;
|
||||
} catch (IOException e) {
|
||||
throw new ExportSnapshotException("Failed to copy the snapshot directory: from=" +
|
||||
snapshotDir + " to=" + initialOutputSnapshotDir, e);
|
||||
} finally {
|
||||
if (copySucceeded) {
|
||||
if (filesUser != null || filesGroup != null) {
|
||||
LOG.warn((filesUser == null ? "" : "Change the owner of " + needSetOwnerDir + " to "
|
||||
+ filesUser)
|
||||
|
@ -1048,6 +1051,7 @@ public class ExportSnapshot extends AbstractHBaseTool implements Tool {
|
|||
setPermissionParallel(outputFs, (short)filesMode, travesedPaths, conf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Write a new .snapshotinfo if the target name is different from the source name
|
||||
if (!targetName.equals(snapshotName)) {
|
||||
|
|
Loading…
Reference in New Issue