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

   ## What changes were proposed in this pull request?
   
   `StreamBlockInputStream` keeps a request high-water mark, `requestedLength`: 
the block offset up to which data has already been requested from the datanode 
on the current gRPC stream. `readBlock()` only sends a new `ReadBlock` request 
for bytes past that mark, and the request offset is `requestedLength`.
   
   The fix resets `requestedLength = position` in `closeReader()`: once the 
stream is gone, nothing is outstanding, and a fresh stream must request again 
from the current position. This matches what `seek()` and the retry path in 
`handleExceptions()` already do when buffered data cannot be reused.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17002
   
   ## How was this patch tested?
   
   * New unit test 
`TestStreamBlockInputStream#testReadAfterUnbufferResumesFromPosition`, 
parameterized over a pre-read size larger than the block (1024) and smaller 
than it (4), to cover both failure modes above. A mocked datanode serves 
exactly the requested range; the read timeout is 500 ms and retries are 
disabled. Without the fix, the read after `unbuffer()` times out.
   * New integration test 
`TestStreamReadDatanodeFailover#testStreamReadAfterUnbuffer`, parameterized 
over a pre-read window smaller (16 KB) and larger (32 MB) than a 32 KB key. It 
calls `unbuffer()` + `read()` one more time than there are replicas, then reads 
and verifies the rest of the key. Without the fix it fails once every replica 
has been excluded.


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