[ 
https://issues.apache.org/jira/browse/HADOOP-19474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17938557#comment-17938557
 ] 

ASF GitHub Bot commented on HADOOP-19474:
-----------------------------------------

anujmodi2021 commented on code in PR #7421:
URL: https://github.com/apache/hadoop/pull/7421#discussion_r2013939076


##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java:
##########
@@ -1753,4 +1772,87 @@ protected AbfsRestOperation getSuccessOp(final 
AbfsRestOperationType operationTy
     successOp.hardSetResult(HttpURLConnection.HTTP_OK);
     return successOp;
   }
+
+  private String getPrimaryUserGroup() throws AzureBlobFileSystemException {
+    String primaryUserGroup;
+    if 
(!getAbfsConfiguration().getSkipUserGroupMetadataDuringInitialization()) {
+      try {
+        primaryUserGroup = 
UserGroupInformation.getCurrentUser().getPrimaryGroupName();
+      } catch (IOException ex) {
+        LOG.error("Failed to get primary group for {}, using user name as 
primary group name",
+            getPrimaryUser());
+        primaryUserGroup = getPrimaryUser();
+      }
+    } else {
+      //Provide a default group name
+      primaryUserGroup = getPrimaryUser();
+    }
+    return primaryUserGroup;
+  }
+
+  private String getPrimaryUser() throws AzureBlobFileSystemException {
+    try {
+      return UserGroupInformation.getCurrentUser().getUserName();
+    } catch (IOException ex) {
+      throw new AbfsDriverException(ex);
+    }
+  }
+
+  /**
+   * Creates a VersionedFileStatus object from the ListResultEntrySchema.
+   * @param entry ListResultEntrySchema object.
+   * @param uri to be used for the path conversion.
+   * @return VersionedFileStatus object.
+   * @throws AzureBlobFileSystemException if transformation fails.
+   */
+  protected VersionedFileStatus getVersionedFileStatusFromEntry(
+      ListResultEntrySchema entry, URI uri) throws 
AzureBlobFileSystemException {
+    long blockSize = abfsConfiguration.getAzureBlockSize();
+    final String owner, group;
+    try{
+      if (identityTransformer != null) {
+        owner = identityTransformer.transformIdentityForGetRequest(
+            entry.owner(), true, getPrimaryUser());
+        group = identityTransformer.transformIdentityForGetRequest(
+            entry.group(), false, getPrimaryUserGroup());
+      } else {
+        owner = null;

Review Comment:
   Makes sense.
   Removed





> ABFS: [FnsOverBlob] Listing Optimizations to avoid multiple iteration over 
> list response.
> -----------------------------------------------------------------------------------------
>
>                 Key: HADOOP-19474
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19474
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs/azure
>    Affects Versions: 3.5.0, 3.4.1
>            Reporter: Anuj Modi
>            Assignee: Anuj Modi
>            Priority: Major
>              Labels: pull-request-available
>
> On blob endpoint, there are a couple of handling that is needed to be done on 
> client side.
> This involves:
>  # Parsing of xml response and converting them to VersionedFileStatus list
>  # Removing duplicate entries for non-empty explicit directories coming due 
> to presence of the marker files
>  # Trigerring Rename recovery on the previously failed rename indicated by 
> the presence of pending json file.
> Currently all three are done in a separate iteration over whole list. This is 
> to pbring all those things to a common place so that single iteration over 
> list reposne can handle all three.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to