You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "devabhishekpal (via GitHub)" <gi...@apache.org> on 2025/02/18 14:43:17 UTC

Re: [PR] HDDS-12156. Add container health task metrics in Recon. [ozone]

devabhishekpal commented on code in PR #7786:
URL: https://github.com/apache/ozone/pull/7786#discussion_r1959894304


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/fsck/ContainerHealthTask.java:
##########
@@ -192,30 +198,58 @@ private void checkAndProcessContainers(
   }
 
   private void logUnhealthyContainerStats(
-      Map<UnHealthyContainerStates, Map<String, Long>>
-          unhealthyContainerStateStatsMap) {
-    unhealthyContainerStateStatsMapForTesting =
-        new HashMap<>(unhealthyContainerStateStatsMap);
+      Map<UnHealthyContainerStates, Map<String, Long>> unhealthyContainerStateStatsMap) {
+
+    unhealthyContainerStateStatsMapForTesting = new HashMap<>(unhealthyContainerStateStatsMap);
+
     // If any EMPTY_MISSING containers, then it is possible that such
     // containers got stuck in the closing state which never got
     // any replicas created on the datanodes. In this case, we log it as
     // EMPTY_MISSING in unhealthy container statistics but do not add it to the table.
-    unhealthyContainerStateStatsMap.entrySet().forEach(stateEntry -> {
-      UnHealthyContainerStates unhealthyContainerState = stateEntry.getKey();
-      Map<String, Long> containerStateStatsMap = stateEntry.getValue();
-      StringBuilder logMsgBuilder =
-          new StringBuilder(unhealthyContainerState.toString());
-      logMsgBuilder.append(" **Container State Stats:** \n\t");
-      containerStateStatsMap.entrySet().forEach(statsEntry -> {
-        logMsgBuilder.append(statsEntry.getKey());
-        logMsgBuilder.append(" -> ");
-        logMsgBuilder.append(statsEntry.getValue());
-        logMsgBuilder.append(" , ");
-      });
-      LOG.info(logMsgBuilder.toString());
+    unhealthyContainerStateStatsMap.forEach((unhealthyContainerState, containerStateStatsMap) -> {
+      // Reset metrics to zero if the map is empty for MISSING or UNDER_REPLICATED

Review Comment:
   Just a general question, why are we handling only for MISSING and UNDER_REPLICATED states? Shouldn't other states be handled as well?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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