adoroszlai commented on code in PR #4694:
URL: https://github.com/apache/ozone/pull/4694#discussion_r1190197564


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ECUnderReplicationHandler.java:
##########
@@ -124,19 +124,15 @@ public int processAndSendCommands(
       return 0;
     }
 
-    // don't place reconstructed replicas on exclude nodes, since they already
-    // have replicas
-    List<DatanodeDetails> excludedNodes = replicas.stream()
-        .map(ContainerReplica::getDatanodeDetails)
-        .collect(Collectors.toList());
-    // DNs that are already waiting to receive replicas cannot be targets
-    excludedNodes.addAll(
-        pendingOps.stream()
-        .filter(containerReplicaOp -> containerReplicaOp.getOpType() ==
-            ContainerReplicaOp.PendingOpType.ADD)
-        .map(ContainerReplicaOp::getTarget)
-        .collect(Collectors.toList()));
+    ReplicationManagerUtil.ExcludedAndUsedNodes excludedAndUsedNodes =
+        ReplicationManagerUtil.getExcludedAndUsedNodes(
+            new ArrayList<>(replicas), Collections.emptySet(), pendingOps,
+            replicationManager);
+    List<DatanodeDetails> excludedNodes
+        = excludedAndUsedNodes.getExcludedNodes();
     excludedNodes.addAll(replicationManager.getExcludedNodes());

Review Comment:
   ```
   excludedNodes.addAll(replicationManager.getExcludedNodes());
   ```
   
   This is done only in EC under renplication handler.  Shouldn't we do the 
same in other handlers?  If so, maybe 
`ReplicationManagerUtil.getExcludedAndUsedNodes` would be a good place to move 
the call, since it already gets reference to `replicationManager`.



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

Reply via email to