Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Blob - listBlobsByHierarchy().iterableByPage(10) - not providing results based on defined page size #19982

Closed
abhikt48 opened this issue Mar 19, 2021 · 3 comments · Fixed by #20093
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Storage Storage Service (Queues, Blobs, Files)
Milestone

Comments

@abhikt48
Copy link

I have a folder in blob container which have 112 blobs. I defined to get 10 blobs per page, but I am getting all 112 blobs in one page response. Please find below sample code to reproduce this issue.

PagedIterable<BlobItem> pagedIterable = getBlobContainerClient().listBlobsByHierarchy("batch/");
        
        Iterable<PagedResponse<BlobItem>> iterableByPage = pagedIterable.iterableByPage(10);
        
        for (PagedResponse<BlobItem> pagedResponse : iterableByPage) {
            Iterator<BlobItem> iterableStream = pagedResponse.getElements().iterator();
            int counter = 1;
            System.err.println("counter - " + counter);
            
            while (iterableStream.hasNext()) {
                BlobItem blobItem = iterableStream.next();
                LOGGER.info(counter++ +" ** listBlob name -'{}' properties-'{}', tags -'{}', version -'{}', snapshot -'{}' ***", 
                                        blobItem.getName(), blobItem.getProperties(), blobItem.getTags(), blobItem.getVersionId(),
                                        blobItem.getSnapshot());
                
            }
        }

ScreenShot
image

To Reproduce

  1. Create Folder with 112 items
  2. Run above sample code and you will get all items in a single page response

Expected behavior
Only 10 blobs should be available in one page response.

Setup (please complete the following information if applicable):
OS: window
IDE : eclipse
Version of the Library used: azure-storage-blob-12.10.0

@ghost ghost added needs-triage This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Mar 19, 2021
@gapra-msft
Copy link
Member

Hi @abhikt48
Thank you for posting this issue. We will take a look at what is going wrong here.

@rickle-msft
Copy link
Contributor

This looks to be a duplicate of #12496 As Gauri mentioned, I'll look into reproducing this either today or Monday

@abhikt48
Copy link
Author

@rickle-msft Just FYI, I did same testing with another approach and it is working fine. I provided custom ListBlobsOptions and setted setMaxResultsPerPage. But I didn't find any affect of pagedIterable.iterableByPage(10), looks like this is redundant. Could you please check and confirm ?

ListBlobsOptions listBlobsOptions = new ListBlobsOptions();
        listBlobsOptions.setPrefix(directoryName);
        listBlobsOptions.setMaxResultsPerPage(10);        
PagedIterable<BlobItem> pagedIterable = getBlobContainerClient().listBlobsByHierarchy(null, listBlobsOptions , null);
Iterable<PagedResponse<BlobItem>> iterableByPage = pagedIterable.iterableByPage(10);

Could you please help me with below queries related with listBlobsByHierarchy(null, listBlobsOptions , null) operation -

  1. listBlobsOptions.setPrefix(directoryName + "prefix"); - I didn't find any option to set directory specifically in ListBlobsOptions or BlobContainerClient.listBlobsByHierarchy(null, listBlobsOptions , null). Can I assume that - directoryName can be provide via listBlobsOptions.setPrefix() only ? Please confirm.
  2. Old SDK provides option to get length of result, but I didn't find any option in New SDK with listBlobsByHierarchy opertaion. Could you please check and confirm if we have any option to check size of list

Old SDK - Length of list

ResultSegment<ListBlobItem> listBlobResult = provider.getBlobListInDirectory(containerName, directoryName, 
                                                                blobPrefix, index, continuationToken);
        totalItems = listBlobResult.getLength();

Please suggest your opinion on above queries, so i can proceed futher.

Regards,
Abhishek Kumar

@joshfree joshfree added Client This issue points to a problem in the data-plane of the library. Storage Storage Service (Queues, Blobs, Files) labels Mar 26, 2021
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Mar 26, 2021
@joshfree joshfree added this to the [2021] April milestone Mar 26, 2021
@joshfree joshfree added bug This issue requires a change to an existing behavior in the product in order to be resolved. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Mar 26, 2021
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-java that referenced this issue Sep 6, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants