sodonnel commented on code in PR #5335:
URL: https://github.com/apache/ozone/pull/5335#discussion_r1333308718
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerManagerImpl.java:
##########
@@ -362,18 +362,10 @@ private NavigableSet<ContainerID> getContainersForOwner(
Pipeline pipeline, String owner) throws IOException {
NavigableSet<ContainerID> containerIDs =
pipelineManager.getContainersInPipeline(pipeline.getId());
- Iterator<ContainerID> containerIDIterator = containerIDs.iterator();
- while (containerIDIterator.hasNext()) {
- ContainerID cid = containerIDIterator.next();
- try {
- if (!getContainer(cid).getOwner().equals(owner)) {
- containerIDIterator.remove();
- }
- } catch (ContainerNotFoundException e) {
- LOG.error("Could not find container info for container {}", cid, e);
- containerIDIterator.remove();
- }
- }
+ containerIDs = new TreeSet<>(containerIDs);
Review Comment:
Why are you creating a `new TreeSet<>(containerIDs)` here? The call to
`pipelineManager.getContainersInPipeline()` already returns the new TreeSet.
--
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]