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



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java
##########
@@ -543,11 +543,15 @@ private void handleUnderReplicatedContainer(final 
ContainerInfo container,
         List<DatanodeDetails> targetReplicas = new ArrayList<>(source);
         // Then add any pending additions
         targetReplicas.addAll(replicationInFlight);
-
-        int delta = replicationFactor - getReplicaCount(id, replicas);
         final ContainerPlacementStatus placementStatus =
             containerPlacement.validateContainerPlacement(
                 targetReplicas, replicationFactor);
+        int delta = replicationFactor - getReplicaCount(id, replicas);
+        if (placementStatus.isPolicySatisfied() && delta <= 0) {

Review comment:
       Rather than this new IF block here, would it make sense to simply add:
   
   ```
   if (replicasNeeded <= 0) {
     LOG.debug(...);
     return;
   }
   
   At line 554 / 558, just after the line:
   
   ```
           final int replicasNeeded
               = delta < misRepDelta ? misRepDelta : delta;
   ```
   
   That would avoid needing to check call `placementStatus.isPolicySatisfied()` 
and then `placementStatus.misReplicationCount()`.




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org

Reply via email to