sodonnel commented on code in PR #3836:
URL: https://github.com/apache/ozone/pull/3836#discussion_r1010318479


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ECUnderReplicationHandler.java:
##########
@@ -407,35 +408,49 @@ private Map<DatanodeDetails, SCMCommand<?>> 
processMisreplication(
           List<DatanodeDetails> deletionInFlight, ContainerInfo container,
           List<DatanodeDetails> excludedNodes,
           Map<Integer, Pair<ContainerReplica, NodeStatus>> sources,
-          Set<Integer> createdIndexes,
+          Set<Integer> excludedIndexes,
           ContainerHealthResult.UnderReplicatedHealthResult
                   containerHealthResult)
           throws IOException {
-    if (containerHealthResult.isSufficientlyReplicatedAfterPending() ||
+    if (containerHealthResult.isSufficientlyReplicatedAfterPending() &&
             containerHealthResult.getMisreplicationCountAfterPending()
-                    <= createdIndexes.size()) {
+                    <= excludedIndexes.size()) {
       return Collections.emptyMap();
     }
     Map<DatanodeDetails, SCMCommand<?>> commands = new HashMap<>();
+
     List<Integer> sortedReplicaIdx =
             getSourcesStream(replicas, deletionInFlight)
-                    .collect(Collectors.groupingBy(
-                            r -> r.getLeft().getReplicaIndex(),
-                            Collectors.counting()))
-                    .entrySet().stream()
-                    .sorted(Comparator.comparingLong(Map.Entry::getValue))
-                    .map(Map.Entry::getKey).collect(Collectors.toList());
+            .map(Pair::getKey).collect(Collectors.groupingBy(r ->

Review Comment:
   I've got no idea what this code is doing, and I have stared at it too long 
already. It needs some comments to explain it at least.



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