peterxcli opened a new pull request, #11518: URL: https://github.com/apache/ozone/pull/11518
## What changes were proposed in this pull request? Positioned reads in `BlockInputStream` now reuse the block's existing chunk streams. Before this change, every positioned read created and closed a temporary `ChunkInputStream` for each chunk it touched. This builds on the merged #11348. The checksum alignment and range copy move from `ChunkInputStream` into a new `ChunkReader`, which keeps no position and no data buffers. Concurrent positioned reads can therefore share a chunk stream without touching its sequential-read state. Each positioned read still acquires its own datanode client and releases it afterwards. Short-circuit reads still read the local block file. To make sharing safe, a positioned read builds its `DatanodeBlockID` as a local value. It no longer writes the stream's `datanodeBlockID` field. When a positioned read fails, it now only refreshes the pipeline. It no longer releases the clients held by the sequential chunk streams. A sequential read still has its own retry handling: if its client points at the old pipeline, its next failure triggers its own refresh. `LocalChunkInputStream` now takes the block's `FileChannel` instead of the `FileInputStream`, because test code is not allowed to import `FileInputStream`. some context: - [HDDS-16325](https://issues.apache.org/jira/browse/HDDS-16325) tracks the larger refactor of the `BlockInputStream` state. This PR does not cover it. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-16983 ## How was this patch tested? Added two unit tests: - Concurrent positioned reads from a local block file. The test checks that the file position and the stream position do not change. - Two overlapping `ChunkReader` reads. The test checks that they do not block each other and do not change the source buffers. The existing positioned-read tests in `TestBlockInputStream`, `TestChunkInputStream`, `TestStreamBlockInputStream`, `TestMultipartInputStream` and the EC stream tests pass, and so does checkstyle. -- 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]
