Skip to content

Commit 8ceaa53

Browse files
committed
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 <taklwu@apache.org>
1 parent 59e43a2 commit 8ceaa53

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/CacheAwareLoadBalancer.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,15 @@ private boolean serverHasCacheSpaceForRegion(BalancerClusterState cluster, int r
322322

323323
@Override
324324
public void throttle(RegionPlan plan) {
325-
synchronized (this) {
326-
try {
327-
// Release the monitor while waiting to avoid blocking other threads.
328-
wait(getThrottleDurationMs(plan));
329-
} catch (InterruptedException e) {
330-
throw new RuntimeException(e);
325+
long throttlingTime = getThrottleDurationMs(plan);
326+
if (throttlingTime > 0) {
327+
synchronized (this) {
328+
try {
329+
// Release the monitor while waiting to avoid blocking other threads.
330+
wait(getThrottleDurationMs(plan));
331+
} catch (InterruptedException e) {
332+
throw new RuntimeException(e);
333+
}
331334
}
332335
}
333336
}

0 commit comments

Comments
 (0)