chungen0126 opened a new pull request, #10827: URL: https://github.com/apache/ozone/pull/10827
## What changes were proposed in this pull request? When performing positioned reads at or past the End-Of-File (EOF) using OzoneFSInputStream#read(long, ByteBuffer), the stream does not correctly return -1 when no bytes can be read. This violates the standard Hadoop ByteBufferPositionedReadable contract for streams, where a read at EOF should return -1 to indicate that no more data is available. Specifically, this PR includes the following changes: - MultipartInputStream: Added validation logic in readFully(long, ByteBuffer) to track remainingBeforeRead. If the buffer's remaining space has not changed after the read operation (meaning 0 bytes were read), it now explicitly throws an EOFException. - OzoneFSInputStream: Updated read(long, ByteBuffer) to catch the EOFException from the underlying stream. If caught an EOF, it properly translates this into a -1 return value to indicate EOF. - Test Refactoring: Upgraded `TestOzoneFSInputStream` to use `@ParameterizedTest`. This ensures that all read scenarios are tested under both legacy and streaming read paths by toggling the `ozone.client.stream.readblock.enable configuration` (true and false). ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-15920 ## How was this patch tested? https://github.com/chungen0126/ozone/actions/runs/29836011097 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
