Tejaskriya commented on code in PR #5688:
URL: https://github.com/apache/ozone/pull/5688#discussion_r1408779790


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/NodeDecommissionMetrics.java:
##########
@@ -135,10 +135,13 @@ public long getUnhealthyContainers() {
 
   private Map<String, ContainerStateInWorkflow> metricsByHost;
 
+  private Map<String, Long> startTimeByHost;
+
   /** Private constructor. */
   private NodeDecommissionMetrics() {
     this.registry = new MetricsRegistry(METRICS_SOURCE_NAME);
     metricsByHost = new HashMap<>();
+    startTimeByHost = new HashMap<>();

Review Comment:
   The `metricsByHost` which stores host specific metrics is cleared and 
repopulated during each run of the `DatanodeAdminMonitor`. We can see in the 
below method responsible for setting `metricsByHost` in 
`NodeDecommissionMetrics`:
   ```
   public synchronized void metricRecordOfContainerStateByHost(
         Map<String, ContainerStateInWorkflow> containerStatesByHost) {
       metricsByHost.clear();
       metricsByHost.putAll(containerStatesByHost);
     }
   ```
   But the start-time of decommissioning for a DN doesn't need to be set to a 
new value in each iteration of the `DatanodeAdminMonitor`. That is why I 
created a different map to store this information. 
   I think if we want to store it in `ContainerStateInWorkflow`, we will have 
to temporarily store the start-time of each host somewhere in 
metricRecordOfContainerStateByHost method before clearing metricsByHost and 
then reassign it to the same values.
   Is there any other way?



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