Jayer created HDDS-14161:
----------------------------

             Summary: Fix Ozone FS client returns null BlockLocations for 
zero-byte files
                 Key: HDDS-14161
                 URL: https://issues.apache.org/jira/browse/HDDS-14161
             Project: Apache Ozone
          Issue Type: Improvement
          Components: Ozone Client
    Affects Versions: 2.0.0
            Reporter: Jayer


Currently, the Ozone File System client's implementation of 
`org.apache.hadoop.fs.LocatedFileStatus.getBlockLocations()` returns null when 
the file size is 0 byte.

This behavior is inconsistent with the HDFS File System client, which correctly 
returns an empty `BlockLocation[]` array for zero-byte files, as per the 
standard Hadoop FileSystem API contract for files with no blocks.

This commit addresses the compatibility issue by modifying `OzoneFileSystem` to 
return an empty `BlockLocation[]` array when:
 # The file size is 0.
 # The internal block list is empty (which is true for 0-byte files). This 
change ensures better interoperability and seamless compatibility for 
applications relying on the expected behavior of the Hadoop FileSystem API. 



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to