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

   ## What changes were proposed in this pull request?
   
   Follow-up of HDDS-15886 (#11551), from its review comments. This PR depends 
on #11551, so it contains the #11551 commits until that PR is merged. Only the 
last commit belongs to this PR.
   
   Changes:
   
   1. Share the GetBlock call between `BlockInputStream` and 
`StreamBlockInputStream`.
      - Move the GetBlock validators and `getBlockDataUsingGRPCClient` from 
`BlockInputStream` to `BlockExtendedInputStream`. The method now takes the 
client, pipeline and token as parameters.
      - `StreamBlockInputStream#updateBlockLength` uses this method instead of 
calling `ContainerProtocolCalls.getBlock` directly. As a result, the GetBlock 
response for a stream read is now validated in the same way as for 
`BlockInputStream`.
   2. Remove the `StreamBlockInputStream(BlockID, long, ...)` constructor. Only 
`TestStreamBlockInputStream` used it. The test now calls the 
`BlockLocationInfo` constructor through a small `newBlockInfo` helper.
   3. Remove the redundant `blockInfo != null` check in 
`BlockInputStream#initialize`. The constructor already calls 
`blockInfo.getBlockID()`, so `blockInfo` cannot be null.
   
   Client acquisition and retry handling stay in each class:
   
   - `BlockInputStream` uses an `XceiverClientSpi` with short-circuit read, and 
retries with `refreshBlockInfo` and `shouldRetryRead`.
   - `StreamBlockInputStream` uses an `XceiverClientGrpc`. Its `releaseClient` 
also closes the streaming reader, and its `handleExceptions` excludes failed 
datanodes from streaming retries.
   
   To share these too, the base class would need the block ID, pipeline, token 
and client fields. The EC input streams also extend `BlockExtendedInputStream` 
and do not use these fields. That is a larger refactor, so it is not part of 
this PR.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17206
   
   ## How was this patch tested?
   
   - Existing unit tests in `hdds-client`: `org.apache.hadoop.hdds.scm.storage` 
and `org.apache.hadoop.ozone.client.io` (165 tests, including 
`TestBlockInputStream`, `TestStreamBlockInputStream` and 
`TestMultipartInputStream`).
   - `TestHSync#testHSyncSeek`, with and without stream read block.
   


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