Galsza commented on code in PR #6497:
URL: https://github.com/apache/ozone/pull/6497#discussion_r1582903438
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java:
##########
@@ -462,29 +465,47 @@ public List<ContainerInfo> listContainer(long
startContainerID,
final ContainerID containerId = ContainerID.valueOf(startContainerID);
if (state != null) {
if (factor != null) {
- return scm.getContainerManager().getContainers(state).stream()
- .filter(info -> info.containerID().getId() >= startContainerID)
- //Filtering EC replication type as EC will not have factor.
- .filter(info -> info
- .getReplicationType() != HddsProtos.ReplicationType.EC)
- .filter(info -> (info.getReplicationFactor() == factor))
- .sorted().limit(count).collect(Collectors.toList());
+ Stream<ContainerInfo> containerInfoStream =
+ scm.getContainerManager().getContainers(state).stream()
+ .filter(info -> info.containerID().getId() >= startContainerID)
+ //Filtering EC replication type as EC will not have factor.
+ .filter(info -> info
+ .getReplicationType() != HddsProtos.ReplicationType.EC)
+ .filter(info -> (info.getReplicationFactor() == factor))
+ .sorted();
+ List<ContainerInfo> containerInfos = containerInfoStream.collect(
+ Collectors.toList());
+ return
Pair.of(containerInfos.stream().limit(count).collect(Collectors.toList()),
Review Comment:
This is repeated on line 487 you could avoid it by returning outside of the
if-else 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]