Chu Cheng Li created HDDS-16620:
-----------------------------------

             Summary: Expose BlockReadCursor as an iterator of read ranges
                 Key: HDDS-16620
                 URL: https://issues.apache.org/jira/browse/HDDS-16620
             Project: Apache Ozone
          Issue Type: Improvement
            Reporter: Chu Cheng Li


Follow-up to HDDS-16258 ([PR 
#11302|https://github.com/apache/ozone/pull/11302]).

The patch for HDDS-16258 moves chunk lookup and checksum-boundary calculations 
into {{BlockReadCursor}}, but {{KeyValueHandler#readBlockImpl}} still obtains 
the offset, length, and overlapping chunks separately and explicitly advances 
the cursor.

Expose the cursor through {{Iterator<ReadRange>}}, where each range contains 
its block offset, length, and overlapping chunk metadata. The handler can 
consume each range with {{hasNext()}}/{{next()}}, then read, verify, and send 
its data. File I/O and stream lifecycle stay in the handler.

Define advancement as handing out a planned range, and preserve accounting for 
bytes actually read. The handler currently aborts on incomplete reads; retain 
that behavior. Keep fallible range preparation outside {{Iterator.next()}}, 
which cannot declare a checked {{IOException}}.

Reuse the existing cursor and tests. Preserve checksum alignment for uneven 
chunks, short final intervals, {{NONE}}, response metadata controlled by 
{{includeChecksums}}, and stream error/cleanup behavior. Add coverage for 
repeated {{hasNext()}} calls without advancement, complete range iteration, and 
{{NoSuchElementException}} after exhaustion. This follow-up does not require a 
protocol or storage-format change.



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