peterxcli opened a new pull request, #11442:
URL: https://github.com/apache/ozone/pull/11442

   ## What changes were proposed in this pull request?
   
   Follow-up to #11302. `KeyValueHandler#readBlockImpl` asks `BlockReadCursor` 
for the read length and the overlapping chunks in separate calls, then advances 
the cursor itself.
   
   This PR makes `BlockReadCursor` an `Iterator<ReadRange>`. Each range carries 
its block offset, length, and the chunks it overlaps, and `next()` moves past 
the range it returns. The handler reads, verifies, and sends each range, and 
counts the bytes it actually read. A short read still fails the request with 
`EOFException`.
   
   The cursor now validates and caches each chunk's checksum interval in the 
constructor, so `next()` never needs to throw `IOException`. The handler 
positions the block file at each range's offset, which is a no-op for 
sequential reads.
   
   There is no protocol or storage format change.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-16620
   
   ## How was this patch tested?
   
   - Ported `TestBlockReadCursor` to the iterator and added a test for full 
iteration, repeated `hasNext()`, and `NoSuchElementException` after the last 
range.
   - Ran `TestBlockReadCursor` and `TestKeyValueHandler` locally. The latter 
already covers uneven chunks, `NONE` checksums, `includeChecksums`, unexpected 
EOF, and block file cleanup.
   


-- 
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]

Reply via email to