sodonnel commented on a change in pull request #881:
URL: https://github.com/apache/hadoop-ozone/pull/881#discussion_r418516881



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java
##########
@@ -512,25 +523,61 @@ private void handleUnderReplicatedContainer(final 
ContainerInfo container,
       if (source.size() > 0) {
         final int replicationFactor = container
             .getReplicationFactor().getNumber();
-        final int delta = replicationFactor - getReplicaCount(id, replicas);
+        // Want to check if the container is mis-replicated after considering
+        // inflight add and delete.
+        // Create a new list from source (healthy replicas minus pending 
delete)
+        List<DatanodeDetails> targetReplicas = new ArrayList<>();
+        targetReplicas.addAll(source);
+        // Then add any pending additions
+        targetReplicas.addAll(replicationInFlight);
+
+        int delta = replicationFactor - getReplicaCount(id, replicas);
+        final int additionalRacks

Review comment:
       For now, mis-replicated count can only return 0 or 1, as replicas must 
be on at most 2 racks, and if there is an existing replica, it must be on a 
rack already.
   However, if we introduced a new policy "must be on 3 racks", then it would 
be possible to be under replicated with a delta of 1 and mis-replicated count 
could return 2, meaning we need to schedule more than 1 replica now.
   
   You suggestion is valid if we only consider "two racks" as the only option, 
but I am hoping to cover off future enhancements here too.
   
   Do you think that makes sense?




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

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