devmadhuu commented on code in PR #11090:
URL: https://github.com/apache/ozone/pull/11090#discussion_r3868378684
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconContainerMetadataManagerImpl.java:
##########
@@ -514,10 +514,10 @@ private List<Pipeline> getPipelines(ContainerKeyPrefix
containerKeyPrefix)
}
List<Pipeline> pipelines = new ArrayList<>();
if (null != omKeyInfo) {
- omKeyInfo.getKeyLocationVersions().stream().map(
+ omKeyInfo.getKeyLocationVersions().forEach(
omKeyLocationInfoGroup ->
- omKeyLocationInfoGroup.getLocationList()
- .stream().map(omKeyLocationInfo -> pipelines.add(
+ omKeyLocationInfoGroup.getLocationList().forEach(
Review Comment:
```suggestion
pipelines.addAll(
omKeyInfo.getKeyLocationVersions().stream()
.flatMap(g -> g.getLocationList().stream())
.map(OmKeyLocationInfo::getPipeline)
.collect(Collectors.toList()));
```
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconContainerMetadataManagerImpl.java:
##########
@@ -514,10 +514,10 @@ private List<Pipeline> getPipelines(ContainerKeyPrefix
containerKeyPrefix)
}
List<Pipeline> pipelines = new ArrayList<>();
if (null != omKeyInfo) {
- omKeyInfo.getKeyLocationVersions().stream().map(
+ omKeyInfo.getKeyLocationVersions().forEach(
omKeyLocationInfoGroup ->
- omKeyLocationInfoGroup.getLocationList()
- .stream().map(omKeyLocationInfo -> pipelines.add(
+ omKeyLocationInfoGroup.getLocationList().forEach(
+ omKeyLocationInfo -> pipelines.add(
Review Comment:
Also add the following assertions in our existing test
[here](https://github.com/apache/ozone/blob/5ff8b53aa6b73e3026a41c7e04741896932cb92d/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/spi/impl/TestReconContainerMetadataManagerImpl.java#L380)
```
ContainerMetadata cm = containerMap.get(containerId);
assertNotNull(cm.getPipelines());
assertFalse(cm.getPipelines().isEmpty(),
"Pipelines list should be populated from OmKeyLocationInfo");
// If test data has known pipeline count, assert it exactly.
```
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconContainerMetadataManagerImpl.java:
##########
@@ -514,10 +514,10 @@ private List<Pipeline> getPipelines(ContainerKeyPrefix
containerKeyPrefix)
}
List<Pipeline> pipelines = new ArrayList<>();
if (null != omKeyInfo) {
- omKeyInfo.getKeyLocationVersions().stream().map(
+ omKeyInfo.getKeyLocationVersions().forEach(
omKeyLocationInfoGroup ->
- omKeyLocationInfoGroup.getLocationList()
- .stream().map(omKeyLocationInfo -> pipelines.add(
+ omKeyLocationInfoGroup.getLocationList().forEach(
Review Comment:
Its better, if we should de-duplicate the pipeline list here itself rather
at the caller.
--
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]