Will-Lo commented on code in PR #4020:
URL: https://github.com/apache/gobblin/pull/4020#discussion_r1712742235
##########
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/ManifestBasedDataset.java:
##########
@@ -157,20 +161,24 @@ public Iterator<FileSet<CopyEntity>>
getFileSetIterator(FileSystem targetFs, Cop
toDelete.add(targetFs.getFileStatus(fileToCopy));
}
}
- // Only set permission for newly created folders on target
- // To change permissions for existing dirs, expectation is to add the
folder to the manifest
- Set<String> parentFolders = new
HashSet<>(flattenedAncestorPermissions.keySet());
- for (String folder : parentFolders) {
- if (targetFs.exists(new Path(folder))) {
- flattenedAncestorPermissions.remove(folder);
- }
- }
- // We need both precommit step to create the directories copying to, and
a postcommit step to ensure that the execute bit needed for recursive rename is
reset
+
+ // Precreate the directories to avoid an edge case where recursive
rename can create extra directories in the target
CommitStep createDirectoryWithPermissionsCommitStep = new
CreateDirectoryWithPermissionsCommitStep(targetFs, ancestorOwnerAndPermissions,
this.properties);
- CommitStep setPermissionCommitStep = new
SetPermissionCommitStep(targetFs, flattenedAncestorPermissions,
this.properties);
copyEntities.add(new PrePublishStep(datasetURN(), Maps.newHashMap(),
createDirectoryWithPermissionsCommitStep, 1));
- copyEntities.add(new PostPublishStep(datasetURN(), Maps.newHashMap(),
setPermissionCommitStep, 1));
+ if (this.enableSetPermissionPostPublish) {
+ for (String parent : ancestorOwnerAndPermissions.keySet()) {
+ Path currentPath = new Path(parent);
+ for (OwnerAndPermission ownerAndPermission :
ancestorOwnerAndPermissions.get(parent)) {
+ if
(!flattenedAncestorPermissions.containsKey(currentPath.toString()) &&
!targetFs.exists(currentPath)) {
+ flattenedAncestorPermissions.put(currentPath.toString(),
ownerAndPermission);
Review Comment:
I believe they should both be in lockstep (the setpermission step and the
ancestor permissions Gobblin creates by default), so to avoid bugs here in the
permission read step I opted to have them both build from the same set of
permissions
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]