ivandika3 commented on code in PR #8001:
URL: https://github.com/apache/ozone/pull/8001#discussion_r1985942360


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -470,8 +474,16 @@ public BackgroundTaskResult call() {
         if (destVolumeIncreased) {
           destVolume.decrementUsedSpace(containerSize);
         }
+        // Stop timing for failure move
+        long endTime = Time.monotonicNow();
+        metrics.getMoveFailureTime().add(endTime - startTime);
         metrics.incrFailureCount();
       } finally {
+        // Stop timing for successful move
+        if (moveSucceeded) {
+          long endTime = Time.monotonicNow();
+          metrics.getMoveSuccessTime().add(endTime - startTime);
+        }

Review Comment:
   ```suggestion
           long endTime = Time.monotonicNow();
           if (moveSucceeded) {
             metrics.getMoveSuccessTime().add(endTime - startTime);
           } else {
             metrics.getMoveFailureTime().add(endTime - startTime);
           }
   ```



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -470,8 +474,16 @@ public BackgroundTaskResult call() {
         if (destVolumeIncreased) {
           destVolume.decrementUsedSpace(containerSize);
         }
+        // Stop timing for failure move
+        long endTime = Time.monotonicNow();
+        metrics.getMoveFailureTime().add(endTime - startTime);

Review Comment:
   This can be pushed further to the `finally` block.



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -392,6 +392,9 @@ private class DiskBalancerTask implements BackgroundTask {
 
     @Override
     public BackgroundTaskResult call() {
+      //start time

Review Comment:
   Unnecessary comment.



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -392,6 +392,9 @@ private class DiskBalancerTask implements BackgroundTask {
 
     @Override
     public BackgroundTaskResult call() {
+      //start time
+      long startTime = Time.monotonicNow();
+      boolean moveSucceeded = false;

Review Comment:
   Nit: I prefer to have `moveSucceeded` to be `true` and only set to false in 
`exception` so that the main body is try catch body is cleaner.



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