ptlrs commented on code in PR #8609:
URL: https://github.com/apache/ozone/pull/8609#discussion_r2267871038


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/MutableVolumeSet.java:
##########
@@ -158,6 +160,8 @@ private void initializeVolumeSet() throws IOException {
 
     for (String locationString : rawLocations) {
       StorageVolume volume = null;
+      volumeHealthMetrics.incrementTotalVolumes();
+      volumeHealthMetrics.incrementHealthyVolumes();

Review Comment:
   The reason the metric is added before the `try` block is to ensure that when 
the `catch` block decrements the metric, it doesn't result in a negative value. 
   
   If we increment the metric after line 180 and if an exception is thrown any 
time before line 180, the catch block will decrement the count of a 
non-existing volume. 



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