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

Meng-Shuan Tsai updated HDDS-16253:
-----------------------------------
    Status: Patch Available  (was: Open)

> Recon getPipelines() never returns pipelines due to missing terminal stream 
> operation
> -------------------------------------------------------------------------------------
>
>                 Key: HDDS-16253
>                 URL: https://issues.apache.org/jira/browse/HDDS-16253
>             Project: Apache Ozone
>          Issue Type: Bug
>            Reporter: Meng-Shuan Tsai
>            Assignee: Meng-Shuan Tsai
>            Priority: Major
>              Labels: pull-request-available
>
> In 
> [ReconContainerMetadataManagerImpl#getPipelines(ContainerKeyPrefix):|https://github.com/apache/ozone/blob/master/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconContainerMetadataManagerImpl.java#L515-L523]
> {code:java}
> List<Pipeline> pipelines = new ArrayList<>();
> if (null != omKeyInfo) {
>   omKeyInfo.getKeyLocationVersions().stream().map(
>       omKeyLocationInfoGroup ->
>           omKeyLocationInfoGroup.getLocationList()
>               .stream().map(omKeyLocationInfo -> pipelines.add(
>                   omKeyLocationInfo.getPipeline())));
> }
> return pipelines; {code}
> Both nested Stream.map(...) calls are intermediate operations with no 
> terminal operation (forEach/collect/etc.) attached, and the resulting Stream 
> is discarded. Per the java.util.stream contract, traversal of the pipeline 
> source never begins without a terminal operation, so pipelines.add(...) is 
> never actually invoked. The method always returns an empty list.
> Impact: this is the only implementation of getPipelines(), used by 
> ContainerMetadataIterator#next(), which backs 
> ReconContainerMetadataManager#getContainersIterator().
> The resulting ContainerMetadata.pipelines is exposed by:
> - GET /containers/mismatch when `missingIn=SCM`
> - GET /containers/mismatch/deleted
> For every container returned through these paths, `getPipelines()` always 
> returns an empty list, so the response contains:
> {code:java}
> "pipelines": []
> {code}
>  



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