ayushtkn commented on a change in pull request #1925:
URL: https://github.com/apache/hive/pull/1925#discussion_r571923493



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/DirCopyTask.java
##########
@@ -70,9 +76,40 @@ private boolean createAndSetPathOwner(Path destPath, Path 
sourcePath) throws IOE
             destPath, sourcePath, status.getOwner(), status.getGroup(), 
status.getPermission());
     destPath.getFileSystem(conf).setOwner(destPath, status.getOwner(), 
status.getGroup());
     destPath.getFileSystem(conf).setPermission(destPath, 
status.getPermission());
+    setAclsToTarget(status, sourcePath, destPath);
     return createdDir;
   }
 
+  private void setAclsToTarget(FileStatus sourceStatus, Path sourcePath,
+      Path destPath) throws IOException {
+    // Check if distCp options contains preserve ACL.
+    if (isPreserveAcl()) {
+      AclStatus sourceAcls =
+          sourcePath.getFileSystem(conf).getAclStatus(sourcePath);
+      if (sourceAcls != null && sourceAcls.getEntries().size() > 0) {
+        destPath.getFileSystem(conf).removeAcl(destPath);

Review comment:
       I followed the same semantics as DistCp, DistCp also does removeAcl 
first, added as part of HADOOP-16032.
   The reason being if the directory  at the target  has ACCESS scope ACL and 
the directory at source has only Default ACL, so setAcl will not remove the 
ACCESS scope ACL, hence the ACL's on source & dest won't be same. So, to 
counter that removeACl is called first.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to