Repository: hadoop
Updated Branches:
  refs/heads/HDFS-12943 967aab655 -> dc76e0f4d


HADOOP-15801. ABFS: Fixing skipUserGroupMetadata in AzureBlobFileSystemStore.
Contributed by Da Zhou


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/a383ac47
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/a383ac47
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/a383ac47

Branch: refs/heads/HDFS-12943
Commit: a383ac47cabe22e563725fae9de73e5e69e51f3e
Parents: 43bc984
Author: Steve Loughran <ste...@apache.org>
Authored: Tue Oct 2 11:42:52 2018 +0100
Committer: Steve Loughran <ste...@apache.org>
Committed: Tue Oct 2 11:42:52 2018 +0100

----------------------------------------------------------------------
 .../fs/azurebfs/AzureBlobFileSystemStore.java   | 27 ++++++++++++++------
 1 file changed, 19 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/a383ac47/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java
----------------------------------------------------------------------
diff --git 
a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java
 
b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java
index cf7387b..a735ce0 100644
--- 
a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java
+++ 
b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java
@@ -102,6 +102,8 @@ public class AzureBlobFileSystemStore {
   private AbfsClient client;
   private URI uri;
   private final UserGroupInformation userGroupInformation;
+  private final String userName;
+  private final String primaryUserGroup;
   private static final String DATE_TIME_PATTERN = "E, dd MMM yyyy HH:mm:ss 
'GMT'";
   private static final String XMS_PROPERTIES_ENCODING = "ISO-8859-1";
   private static final int LIST_MAX_RESULTS = 5000;
@@ -128,6 +130,15 @@ public class AzureBlobFileSystemStore {
     }
 
     this.userGroupInformation = userGroupInformation;
+    this.userName = userGroupInformation.getShortUserName();
+
+    if (!abfsConfiguration.getSkipUserGroupMetadataDuringInitialization()) {
+      primaryUserGroup = userGroupInformation.getPrimaryGroupName();
+    } else {
+      //Provide a default group name
+      primaryUserGroup = userName;
+    }
+
     this.azureAtomicRenameDirSet = new HashSet<>(Arrays.asList(
         
abfsConfiguration.getAzureAtomicRenameDirs().split(AbfsHttpConstants.COMMA)));
 
@@ -462,8 +473,8 @@ public class AzureBlobFileSystemStore {
       final boolean hasAcl = AbfsPermission.isExtendedAcl(permissions);
 
       return new VersionedFileStatus(
-              owner == null ? userGroupInformation.getUserName() : owner,
-              group == null ? userGroupInformation.getPrimaryGroupName() : 
group,
+              owner == null ? userName : owner,
+              group == null ? primaryUserGroup : group,
               permissions == null ? new AbfsPermission(FsAction.ALL, 
FsAction.ALL, FsAction.ALL)
                       : AbfsPermission.valueOf(permissions),
               hasAcl,
@@ -489,8 +500,8 @@ public class AzureBlobFileSystemStore {
       final boolean hasAcl = AbfsPermission.isExtendedAcl(permissions);
 
       return new VersionedFileStatus(
-              owner == null ? userGroupInformation.getUserName() : owner,
-              group == null ? userGroupInformation.getPrimaryGroupName() : 
group,
+              owner == null ? userName : owner,
+              group == null ? primaryUserGroup : group,
               permissions == null ? new AbfsPermission(FsAction.ALL, 
FsAction.ALL, FsAction.ALL)
                       : AbfsPermission.valueOf(permissions),
               hasAcl,
@@ -528,8 +539,8 @@ public class AzureBlobFileSystemStore {
       long blockSize = abfsConfiguration.getAzureBlockSize();
 
       for (ListResultEntrySchema entry : retrievedSchema.paths()) {
-        final String owner = entry.owner() == null ? 
userGroupInformation.getUserName() : entry.owner();
-        final String group = entry.group() == null ? 
userGroupInformation.getPrimaryGroupName() : entry.group();
+        final String owner = entry.owner() == null ? userName : entry.owner();
+        final String group = entry.group() == null ? primaryUserGroup : 
entry.group();
         final FsPermission fsPermission = entry.permissions() == null
                 ? new AbfsPermission(FsAction.ALL, FsAction.ALL, FsAction.ALL)
                 : AbfsPermission.valueOf(entry.permissions());
@@ -761,8 +772,8 @@ public class AzureBlobFileSystemStore {
             : AbfsPermission.valueOf(permissions);
 
     final AclStatus.Builder aclStatusBuilder = new AclStatus.Builder();
-    aclStatusBuilder.owner(owner == null ? userGroupInformation.getUserName() 
: owner);
-    aclStatusBuilder.group(group == null ? 
userGroupInformation.getPrimaryGroupName() : group);
+    aclStatusBuilder.owner(owner == null ? userName : owner);
+    aclStatusBuilder.group(group == null ? primaryUserGroup : group);
 
     aclStatusBuilder.setPermission(fsPermission);
     aclStatusBuilder.stickyBit(fsPermission.getStickyBit());


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to