hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1639108 - /hive/trunk/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
Date Wed, 12 Nov 2014 22:01:55 GMT
Author: brock
Date: Wed Nov 12 22:01:55 2014
New Revision: 1639108

URL: http://svn.apache.org/r1639108
Log:
HIVE-8791 - Hive permission inheritance throws exception S3 (Szehon via Brock)

Modified:
    hive/trunk/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java

Modified: hive/trunk/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
URL: http://svn.apache.org/viewvc/hive/trunk/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java?rev=1639108&r1=1639107&r2=1639108&view=diff
==============================================================================
--- hive/trunk/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java (original)
+++ hive/trunk/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java Wed
Nov 12 22:01:55 2014
@@ -551,7 +551,13 @@ public class Hadoop23Shims extends Hadoo
     FileStatus fileStatus = fs.getFileStatus(file);
     AclStatus aclStatus = null;
     if (isExtendedAclEnabled(conf)) {
-      aclStatus = fs.getAclStatus(file);
+      //Attempt extended Acl operations only if its enabled, but don't fail the operation
regardless.
+      try {
+        aclStatus = fs.getAclStatus(file);
+      } catch (Exception e) {
+        LOG.info("Skipping ACL inheritance: File system for path " + file + " " +
+                "does not support ACLs but dfs.namenode.acls.enabled is set to true: " +
e, e);
+      }
     }
     return new Hadoop23FileStatus(fileStatus, aclStatus);
   }
@@ -567,19 +573,25 @@ public class Hadoop23Shims extends Hadoo
       run(fsShell, new String[]{"-chgrp", "-R", group, target.toString()});
 
       if (isExtendedAclEnabled(conf)) {
-        AclStatus aclStatus = ((Hadoop23FileStatus) sourceStatus).getAclStatus();
-        List<AclEntry> aclEntries = aclStatus.getEntries();
-        removeBaseAclEntries(aclEntries);
-
-        //the ACL api's also expect the tradition user/group/other permission in the form
of ACL
-        FsPermission sourcePerm = sourceStatus.getFileStatus().getPermission();
-        aclEntries.add(newAclEntry(AclEntryScope.ACCESS, AclEntryType.USER, sourcePerm.getUserAction()));
-        aclEntries.add(newAclEntry(AclEntryScope.ACCESS, AclEntryType.GROUP, sourcePerm.getGroupAction()));
-        aclEntries.add(newAclEntry(AclEntryScope.ACCESS, AclEntryType.OTHER, sourcePerm.getOtherAction()));
-
-        //construct the -setfacl command
-        String aclEntry = Joiner.on(",").join(aclStatus.getEntries());
-        run(fsShell, new String[]{"-setfacl", "-R", "--set", aclEntry, target.toString()});
+        //Attempt extended Acl operations only if its enabled, 8791but don't fail the operation
regardless.
+        try {
+          AclStatus aclStatus = ((Hadoop23FileStatus) sourceStatus).getAclStatus();
+          List<AclEntry> aclEntries = aclStatus.getEntries();
+          removeBaseAclEntries(aclEntries);
+
+          //the ACL api's also expect the tradition user/group/other permission in the form
of ACL
+          FsPermission sourcePerm = sourceStatus.getFileStatus().getPermission();
+          aclEntries.add(newAclEntry(AclEntryScope.ACCESS, AclEntryType.USER, sourcePerm.getUserAction()));
+          aclEntries.add(newAclEntry(AclEntryScope.ACCESS, AclEntryType.GROUP, sourcePerm.getGroupAction()));
+          aclEntries.add(newAclEntry(AclEntryScope.ACCESS, AclEntryType.OTHER, sourcePerm.getOtherAction()));
+
+          //construct the -setfacl command
+          String aclEntry = Joiner.on(",").join(aclStatus.getEntries());
+          run(fsShell, new String[]{"-setfacl", "-R", "--set", aclEntry, target.toString()});
+        } catch (Exception e) {
+          LOG.info("Skipping ACL inheritance: File system for path " + target + " " +
+                  "does not support ACLs but dfs.namenode.acls.enabled is set to true: "
+ e, e);
+        }
       } else {
         String permission = Integer.toString(sourceStatus.getFileStatus().getPermission().toShort(),
8);
         run(fsShell, new String[]{"-chmod", "-R", permission, target.toString()});



Mime
View raw message