[ https://issues.apache.org/jira/browse/HADOOP-19572?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17953174#comment-17953174 ]
ASF GitHub Bot commented on HADOOP-19572: ----------------------------------------- anujmodi2021 commented on code in PR #7698: URL: https://github.com/apache/hadoop/pull/7698#discussion_r2100427030 ########## hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsBlobClient.java: ########## @@ -400,37 +398,46 @@ public ListResponseData listPath(final String relativePath, final boolean recurs listResponseData.setOp(retryListOp); } } + return listResponseData; + } - if (isEmptyListResults(listResponseData) && is404CheckRequired) { + /** + * Post-processing of the list operation on Blob endpoint. + * There are two client handing to be done on list output. + * 1. Empty List returned on server could potentially mean path is a file. + * 2. There can be duplicates returned from the server for explicit non-empty directory. + * @param relativePath relative path to be listed. + * @param fileStatuses list of file statuses returned from the server. + * @param tracingContext tracing context to trace server calls. + * @param uri URI to be used for path conversion. + * @return rectified list of file statuses. + * @throws AzureBlobFileSystemException if any failure occurs. + */ + @Override + public List<FileStatus> postListProcessing(String relativePath, List<FileStatus> fileStatuses, + TracingContext tracingContext, URI uri) throws AzureBlobFileSystemException { + List<FileStatus> rectifiedFileStatuses = new ArrayList<>(); + if (fileStatuses.isEmpty() && !ROOT_PATH.equals(relativePath)) { // If the list operation returns no paths, we need to check if the path is a file. // If it is a file, we need to return the file in the list. + // If it is a directory or root path, we need to return an empty list. // If it is a non-existing path, we need to throw a FileNotFoundException. - if (relativePath.equals(ROOT_PATH)) { - // Root Always exists as directory. It can be an empty listing. - return listResponseData; - } AbfsRestOperation pathStatus = this.getPathStatus(relativePath, tracingContext, null, false); BlobListResultSchema listResultSchema = getListResultSchemaFromPathStatus(relativePath, pathStatus); - LOG.debug("ListBlob attempted on a file path. Returning file status."); - List<VersionedFileStatus> fileStatusList = new ArrayList<>(); + LOG.debug("ListStatus attempted on a file path {}. Returning file status.", relativePath); Review Comment: This is fine as originally ListStatus was attempted on file path. > ABFS: [FnsOverBlob] Empty Page Issue on Subsequent ListBlob call > ---------------------------------------------------------------- > > Key: HADOOP-19572 > URL: https://issues.apache.org/jira/browse/HADOOP-19572 > Project: Hadoop Common > Issue Type: Sub-task > Components: fs/azure > Affects Versions: 3.5.0, 3.4.1 > Reporter: Anuj Modi > Priority: Major > Labels: pull-request-available > > We came across a new behavior from server where ListBlob call can return > empty list even after returning a next marker(continuation token) from > previous list call. > This is to handle that case and do not infer listing to be incomplete. -- 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