reef-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (REEF-2022) AzureBlockBlobFileSystem (REEF) - GetChildren does not work for containers
Date Fri, 08 Jun 2018 16:26:00 GMT

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

ASF GitHub Bot commented on REEF-2022:
--------------------------------------

sharathmalladi commented on a change in pull request #1464: [REEF-2022] Fixed AzureBlockBlobFileSystem.GetChildren
api and unit tests
URL: https://github.com/apache/reef/pull/1464#discussion_r190373455
 
 

 ##########
 File path: lang/cs/Org.Apache.REEF.IO/FileSystem/AzureBlob/AzureBlockBlobFileSystem.cs
 ##########
 @@ -157,22 +157,58 @@ public void DeleteDirectory(Uri directoryUri)
         }
 
         /// <summary>
-        /// Gets the children of the blob "directory."
+        /// Gets the children of the container (if the uri has segments)
+        /// or containers in the storage account (if the uri has no segments)
         /// </summary>
         public IEnumerable<Uri> GetChildren(Uri directoryUri)
         {
+            string[] segments = directoryUri.Segments;
             BlobContinuationToken blobContinuationToken = null;
-            var path = directoryUri.AbsolutePath.Trim('/');
+
+            // If at the root, return all containers
+            if (segments.Count() == 1)
+            {
+                do
+                {
+                    ContainerResultSegment containerListing = _client.ListContainersSegmented(blobContinuationToken);
+
+                    if (containerListing.Results != null)
+                    {
+                        foreach (CloudBlobContainer containerItem in containerListing.Results)
+                        {
+                            yield return containerItem.Uri;
+                        }
+                    }
+
+                    blobContinuationToken = containerListing.ContinuationToken;
+                }
+                while (blobContinuationToken != null);
+                yield break;
+            }
+
+            // If not at the root folder, return all blobs within the container
+            string containerName = segments[1];
 
 Review comment:
   Fixed by changing the condition earlier by ensuring this line is not executed if segments.Count()
<= 1. #Resolved

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> AzureBlockBlobFileSystem (REEF) - GetChildren does not work for containers
> --------------------------------------------------------------------------
>
>                 Key: REEF-2022
>                 URL: https://issues.apache.org/jira/browse/REEF-2022
>             Project: REEF
>          Issue Type: Bug
>          Components: REEF.NET IO
>    Affects Versions: 0.16
>            Reporter: Sharath Malladi
>            Assignee: Sharath Malladi
>            Priority: Major
>
> Repro steps:
> 1. Created a container with multiple files. https://tyclintwscratchstg.blob.core.windows.net/testcontainer/
> 2. Call AzureBlockBlobFileSystem.GetChildren("https://tyclintwscratchstg.blob.core.windows.net/testcontainer/");
>  
> Actual result:
> Throws the exception "The remote server returned an error: (404) Not Found."
>  
> Expected result:
> The files are properly listed.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message