[ 
https://issues.apache.org/jira/browse/HDDS-17206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chu Cheng Li reassigned HDDS-17206:
-----------------------------------

    Assignee: Chu Cheng Li

> Refactor GetBlock handling shared by BlockInputStream and 
> StreamBlockInputStream
> --------------------------------------------------------------------------------
>
>                 Key: HDDS-17206
>                 URL: https://issues.apache.org/jira/browse/HDDS-17206
>             Project: Apache Ozone
>          Issue Type: Sub-task
>            Reporter: Chung-En Lee
>            Assignee: Chu Cheng Li
>            Priority: Major
>
> Follow-up of HDDS-15886, from the review comments on 
> https://github.com/apache/ozone/pull/11551.
> HDDS-15886 added StreamBlockInputStream#updateBlockLength, which sends 
> GetBlock to get the length of an under-construction block from the datanode. 
> BlockInputStream already has similar GetBlock code, and the change left some 
> leftovers. This JIRA cleans them up:
> 1. Reuse the GetBlock code from BlockInputStream.
>    Move BlockInputStream#getBlockData and #getBlockDataUsingGRPCClient into 
> BlockExtendedInputStream, and use them in 
> StreamBlockInputStream#updateBlockLength instead of calling 
> ContainerProtocolCalls.getBlock directly.
>    - 
> https://github.com/apache/ozone/blob/df42f7f60a2db3c06ed85e781ffdf89e02e0ccf0/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java#L228-L235
>    - 
> https://github.com/apache/ozone/blob/df42f7f60a2db3c06ed85e781ffdf89e02e0ccf0/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java#L302-L313
>    The two classes use different clients (BlockInputStream: XceiverClientSpi 
> with short-circuit read; StreamBlockInputStream: XceiverClientGrpc) and 
> different retry handling (BlockInputStream#initialize: refreshBlockInfo + 
> shouldRetryRead; StreamBlockInputStream: handleExceptions with datanode 
> exclusion), so the client and retry handling need to be unified as part of 
> this.
> 2. Remove the StreamBlockInputStream(BlockID, long, ...) constructor.
>    After HDDS-15886, BlockInputStreamFactoryImpl uses the 
> StreamBlockInputStream(BlockLocationInfo, ...) constructor; the old one is 
> only used by TestStreamBlockInputStream.
> 3. Remove the redundant null check in BlockInputStream#initialize.
>    `blockInfo != null && blockInfo.isUnderConstruction()` — blockInfo cannot 
> be null, since the constructor already calls blockInfo.getBlockID().
>    - 
> https://github.com/apache/ozone/blob/df42f7f60a2db3c06ed85e781ffdf89e02e0ccf0/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java#L165



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