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

Meng-Shuan Tsai updated HDDS-16253:
-----------------------------------
    Description: 
In 
[ReconContainerMetadataManagerImpl#getPipelines(ContainerKeyPrefix):|#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(). That iterator is 
consumed by two REST endpoints in ContainerEndpoint:
 * GET /containers/mismatch (getContainerMisMatchInsights()) 
 * GET /containers/mismatch/deleted (getOmContainersDeletedInSCM())

Both always return "pipelines": [] for every container.

  was:
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, regardless of the 
key's actual pipeline data.

Impact: this is the only implementation of getPipelines(), used by 
ContainerMetadataIterator#next(), which backs 
ReconContainerMetadataManager#getContainersIterator(). That iterator is 
consumed by two REST endpoints in ContainerEndpoint: GET /containers/mismatch 
(getContainerMisMatchInsights()) and GET /containers/mismatch/deleted 
(getOmContainersDeletedInSCM()). Both always return "pipelines": [] for every 
container.


> 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
>
> In 
> [ReconContainerMetadataManagerImpl#getPipelines(ContainerKeyPrefix):|#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(). That iterator is 
> consumed by two REST endpoints in ContainerEndpoint:
>  * GET /containers/mismatch (getContainerMisMatchInsights()) 
>  * GET /containers/mismatch/deleted (getOmContainersDeletedInSCM())
> Both always return "pipelines": [] for every container.



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