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

wchevreuil pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 63a2278e050 HBASE-30300 ADDENDUM: This is a branch-2 only addendum to 
add throttling time check already present in master and branch-3 (#8516)
63a2278e050 is described below

commit 63a2278e0501522192f994774cb48cf2b875b850
Author: Wellington Ramos Chevreuil <[email protected]>
AuthorDate: Thu Jul 30 20:49:25 2026 +0100

    HBASE-30300 ADDENDUM: This is a branch-2 only addendum to add throttling 
time check already present in master and branch-3 (#8516)
    
    Signed-off-by: Tak Lon (Stephen) Wu <[email protected]>
---
 .../hbase/master/balancer/CacheAwareLoadBalancer.java     | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/CacheAwareLoadBalancer.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/CacheAwareLoadBalancer.java
index 42fcee58900..0bd7cfc5be1 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/CacheAwareLoadBalancer.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/CacheAwareLoadBalancer.java
@@ -322,12 +322,15 @@ public class CacheAwareLoadBalancer extends 
StochasticLoadBalancer {
 
   @Override
   public void throttle(RegionPlan plan) {
-    synchronized (this) {
-      try {
-        // Release the monitor while waiting to avoid blocking other threads.
-        wait(getThrottleDurationMs(plan));
-      } catch (InterruptedException e) {
-        throw new RuntimeException(e);
+    long throttlingTime = getThrottleDurationMs(plan);
+    if (throttlingTime > 0) {
+      synchronized (this) {
+        try {
+          // Release the monitor while waiting to avoid blocking other threads.
+          wait(getThrottleDurationMs(plan));
+        } catch (InterruptedException e) {
+          throw new RuntimeException(e);
+        }
       }
     }
   }

Reply via email to