ChenSammi commented on code in PR #8006:
URL: https://github.com/apache/ozone/pull/8006#discussion_r1986779463


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -363,17 +363,19 @@ public BackgroundTaskQueue getTasks() {
   private boolean shouldDelay() {
     // We should wait for next AvailableTime.
     if (Time.monotonicNow() <= nextAvailableTime.get()) {
+      LOG.info("Skipping balancing until nextAvailableTime ({})", 
nextAvailableTime.get());
       return true;
     }
     // Calculate the next AvailableTime based on bandwidth
     long bytesBalanced = balancedBytesInLastWindow.getAndSet(0L);
-
     final int megaByte = 1024 * 1024;
 
     // converting disk bandwidth in byte/millisec
     float bytesPerMillisec = bandwidthInMB * megaByte / 1000f;
-    nextAvailableTime.set(Time.monotonicNow() +
-        ((long) (bytesBalanced / bytesPerMillisec)));
+    long delayInMillisec = (long) (bytesBalanced / bytesPerMillisec);
+    nextAvailableTime.set(Time.monotonicNow() + delayInMillisec);
+    LOG.debug("Bytes balanced: {} MB, Calculated delay: {} ms ({} sec)",

Review Comment:
     if (LOG.isDebugEnabled()) {
        LOG.debug("Bytes balanced: {} MB, Calculated delay: {} ms ({} sec)",
               bytesBalanced / megaByte, delayInMillisec, delayInMillisec / 
1000);
    }
   
   For any debug level log, please add the isDebugEnabled() detection. 



-- 
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-unsubscr...@ozone.apache.org

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


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

Reply via email to