errose28 commented on code in PR #3920:
URL: https://github.com/apache/ozone/pull/3920#discussion_r1050288902


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/LegacyReplicationManager.java:
##########
@@ -523,22 +523,32 @@ protected void processContainer(ContainerInfo container,
         boolean sufficientlyReplicated = replicaSet.isSufficientlyReplicated();
         boolean placementSatisfied = placementStatus.isPolicySatisfied();
         if (!sufficientlyReplicated || !placementSatisfied) {
-          if (!sufficientlyReplicated) {
+          // Increment report stats.
+          if (!sufficientlyReplicated && replicaSet.isUnrecoverable()) {
+            report.incrementAndSample(HealthState.MISSING,
+                container.containerID());
             report.incrementAndSample(
                 HealthState.UNDER_REPLICATED, container.containerID());
-            if (replicaSet.isUnrecoverable()) {
-              report.incrementAndSample(HealthState.MISSING,
-                  container.containerID());
-            }
           }
           if (!placementSatisfied) {
             report.incrementAndSample(HealthState.MIS_REPLICATED,
                 container.containerID());
 
           }
+          // Replicate container if needed.
           if (!inflightReplication.isFull() || !inflightDeletion.isFull()) {
-            handleUnderReplicatedContainer(container,
-                replicaSet, placementStatus);
+            if (!replicaSet.isUnrecoverable()) {
+              if (replicaSet.getHealthyReplicaCount() == 0 &&
+                  replicaSet.getUnhealthyReplicaCount() != 0) {
+                handleAllReplicasUnhealthy(container, replicaSet,
+                    placementStatus, report);
+              } else {
+                report.incrementAndSample(
+                    HealthState.UNDER_REPLICATED, container.containerID());
+                handleUnderReplicatedHealthy(container,
+                    replicaSet, placementStatus);
+              }
+            }

Review Comment:
   Good catch. I fixed this in 
[fe2fd7e](https://github.com/apache/ozone/pull/3920/commits/fe2fd7e0b047c6f1b06e9b5b8ecb1f9f5fc07600)
 by having a dedicated method to generate the replication related parts of the 
report. Having them mixed with the handlers for these cases was messy.



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