This is an automated email from the ASF dual-hosted git repository.

sammichen pushed a commit to branch HDDS-5713
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/HDDS-5713 by this push:
     new 8a16109551 HDDS-12432. [DiskBalancer] Respect property 
"hdds.datanode.disk.balancer.max.disk.throughputInMBPerSec" (#8006)
8a16109551 is described below

commit 8a16109551e1062dd62b62b0e8abc3fcb84c8730
Author: Gargi Jaiswal <[email protected]>
AuthorDate: Tue Mar 11 08:50:05 2025 +0530

    HDDS-12432. [DiskBalancer] Respect property 
"hdds.datanode.disk.balancer.max.disk.throughputInMBPerSec" (#8006)
---
 .../ozone/container/diskbalancer/DiskBalancerService.java  | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java
 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java
index ac1ee19123..b51490f4c9 100644
--- 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java
+++ 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java
@@ -363,17 +363,24 @@ public BackgroundTaskQueue getTasks() {
   private boolean shouldDelay() {
     // We should wait for next AvailableTime.
     if (Time.monotonicNow() <= nextAvailableTime.get()) {
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("Skipping balancing until nextAvailableTime ({} ms)",
+            (nextAvailableTime.get() - Time.monotonicNow()));
+      }
       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);
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Bytes balanced: {} MB, Calculated delay: {} ms ({} sec)",
+          bytesBalanced / megaByte, delayInMillisec, delayInMillisec / 1000);
+    }
     return false;
   }
 
@@ -448,6 +455,7 @@ public BackgroundTaskResult call() {
         }
         oldContainer.getContainerData().getVolume()
             .decrementUsedSpace(containerSize);
+        balancedBytesInLastWindow.addAndGet(containerSize);
         metrics.incrSuccessCount(1);
         metrics.incrSuccessBytes(containerSize);
       } catch (IOException e) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to