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


##########
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:
   Done, thanks.  What do you think about merging these two methods, e.g. 
renaming `isMissing` to `unRecoverable` (which seems more general) or vice 
versa?
   
   Note: I think `isUnrecoverable` would be a more standard name for 
`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