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


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/StorageVolumeChecker.java:
##########
@@ -176,12 +175,28 @@ public synchronized void checkAllVolumeSets() {
     }
 
     try {
+      int totalScanned = 0;
       for (VolumeSet volSet : registeredVolumeSets) {
+        long volumeCount = volSet.getVolumesList().size();
+        if (volSet instanceof MutableVolumeSet) {
+          StorageVolume.VolumeType type = ((MutableVolumeSet) 
volSet).getVolumeType();
+          switch (type) {
+          case DATA_VOLUME:
+            metrics.incNumDataVolumesScanned(volumeCount);
+            break;
+          case META_VOLUME:
+            metrics.incNumMetadataVolumesScanned(volumeCount);
+            break;
+          default:
+            break;
+          }
+        }
         volSet.checkAllVolumes(this);
+        totalScanned += volSet.getVolumesList().size();
       }
-
+      metrics.setNumVolumesScannedInLastIteration(totalScanned);

Review Comment:
   Metrics related business logic for `totalScanned` can be removed from here 
by creating a new `metrics.incrNumVolumesScannedInLastIteration(value)` method.



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/StorageVolumeChecker.java:
##########
@@ -176,12 +175,28 @@ public synchronized void checkAllVolumeSets() {
     }
 
     try {
+      int totalScanned = 0;
       for (VolumeSet volSet : registeredVolumeSets) {
+        long volumeCount = volSet.getVolumesList().size();
+        if (volSet instanceof MutableVolumeSet) {
+          StorageVolume.VolumeType type = ((MutableVolumeSet) 
volSet).getVolumeType();
+          switch (type) {
+          case DATA_VOLUME:
+            metrics.incNumDataVolumesScanned(volumeCount);
+            break;
+          case META_VOLUME:
+            metrics.incNumMetadataVolumesScanned(volumeCount);
+            break;
+          default:
+            break;

Review Comment:
   We should log a warning upon reaching the `default` case.



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