[ 
https://issues.apache.org/jira/browse/GOBBLIN-1601?focusedWorklogId=717579&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-717579
 ]

ASF GitHub Bot logged work on GOBBLIN-1601:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 29/Jan/22 19:14
            Start Date: 29/Jan/22 19:14
    Worklog Time Spent: 10m 
      Work Description: arjun4084346 commented on a change in pull request 
#3457:
URL: https://github.com/apache/gobblin/pull/3457#discussion_r795084735



##########
File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyableFile.java
##########
@@ -354,6 +359,36 @@ public static OwnerAndPermission 
resolveReplicatedOwnerAndPermission(FileSystem
     return ownerAndPermissions;
   }
 
+  public static Map<String, OwnerAndPermission> 
resolveReplicatedAncestorOwnerAndPermissionsRecursively(FileSystem sourceFs, 
Path fromPath,
+      Path toPath, CopyConfiguration copyConfiguration) throws IOException {
+
+    Map<String, OwnerAndPermission> ownerAndPermissions = Maps.newHashMap();
+
+    // We only pass directories to this method anyways. Those directories 
themselves need permissions set.
+    Path currentOriginPath = fromPath;
+    Path currentTargetPath = toPath;
+
+    if (!PathUtils.isAncestor(currentTargetPath, currentOriginPath)) {
+      throw new IOException(String.format("currentTargetPath %s must be an 
ancestor of currentOriginPath %s.", currentTargetPath, currentOriginPath));
+    }
+
+    while (PathUtils.isAncestor(currentTargetPath, 
currentOriginPath.getParent())) {
+      
ownerAndPermissions.put(PathUtils.getPathWithoutSchemeAndAuthority(currentOriginPath).toString(),
 resolveReplicatedOwnerAndPermission(sourceFs, currentOriginPath, 
copyConfiguration));
+      currentOriginPath = currentOriginPath.getParent();
+    }
+    // Now currentTargetPath and currentOriginPath are the same path.
+
+    // Walk through the parents and preserve the permissions from Origin -> 
Target as we go in lockstep.
+    while (currentOriginPath != null && currentTargetPath != null
+        && currentOriginPath.getName().equals(currentTargetPath.getName())) {
+      
ownerAndPermissions.put(PathUtils.getPathWithoutSchemeAndAuthority(currentOriginPath).toString(),
 resolveReplicatedOwnerAndPermission(sourceFs, currentOriginPath, 
copyConfiguration));
+      currentOriginPath = currentOriginPath.getParent();

Review comment:
       Okay, I removed that comment. They might not be the same if we are using 
prefixReplacement.




-- 
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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 717579)
    Time Spent: 1h 20m  (was: 1h 10m)

> provide a way to set permission on destination datasets after publishing
> ------------------------------------------------------------------------
>
>                 Key: GOBBLIN-1601
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1601
>             Project: Apache Gobblin
>          Issue Type: Improvement
>            Reporter: Arjun Singh Bora
>            Priority: Major
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to