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


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerReplicaCount.java:
##########
@@ -262,22 +60,24 @@ public boolean isOverReplicated() {
    *
    * @return true if the container is healthy, false otherwise
    */
-  public boolean isHealthy() {
-    return (container.getState() == HddsProtos.LifeCycleState.CLOSED
-        || container.getState() == HddsProtos.LifeCycleState.QUASI_CLOSED)
-        && replica.stream()
+  default boolean isHealthy() {
+    HddsProtos.LifeCycleState containerState = getContainer().getState();
+    return (containerState == HddsProtos.LifeCycleState.CLOSED
+        || containerState == HddsProtos.LifeCycleState.QUASI_CLOSED)
+        && getReplicas().stream()
         .filter(r -> r.getDatanodeDetails().getPersistedOpState() == 
IN_SERVICE)
         .allMatch(r -> LegacyReplicationManager.compareState(
-            container.getState(), r.getState()));
+            containerState, r.getState()));
+
   }
 
   /**
-   * Returns true is there are no replicas of a container available, ie the
-   * set of container replica passed in the constructor has zero entries.
+   * Returns true is there are no replicas of the container available, ie the
+   * set of container replicas has zero entries.
    *
    * @return true if there are no replicas, false otherwise.
    */
-  public boolean isMissing() {
-    return replica.size() == 0;
+  default boolean isMissing() {

Review Comment:
   For EC, we have a method `public boolean unRecoverable()`. The definition of 
missing for EC is a bit strange. For Ratis it is very clear - there are no 
replicas available at all. For EC, a container is effectively missing if there 
are not dataNum containers available. We probably need to override this in the 
EC class and had it return the the result of unRecoverable.



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