This is an automated email from the ASF dual-hosted git repository.
larsfrancke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/master by this push:
new df70b5a582c HBASE-29835: Fix typos and inconsistencies in
CacheAwareLoadBalancer (#7644)
df70b5a582c is described below
commit df70b5a582ca7d8f794b2b0fc30b217fb41ac215
Author: Lars Francke <[email protected]>
AuthorDate: Tue Jan 20 20:27:12 2026 +0100
HBASE-29835: Fix typos and inconsistencies in CacheAwareLoadBalancer (#7644)
Signed-off-by: Wellington Chevreuil <[email protected]>
---
.../hbase/master/balancer/CacheAwareLoadBalancer.java | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git
a/hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/CacheAwareLoadBalancer.java
b/hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/CacheAwareLoadBalancer.java
index 30e4b5212bf..867c6f8aadb 100644
---
a/hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/CacheAwareLoadBalancer.java
+++
b/hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/CacheAwareLoadBalancer.java
@@ -23,12 +23,11 @@ package org.apache.hadoop.hbase.master.balancer;
* periodically and restores the cache when it is restarted. This balancer
implements a mechanism
* where it maintains the amount by which a region is cached on a region
server. During balancer
* run, a region plan is generated that takes into account this cache
information and tries to
- * move the regions so that the cache minimally impacted.
+ * move the regions so that the cache is minimally impacted.
*/
import static
org.apache.hadoop.hbase.HConstants.BUCKET_CACHE_PERSISTENT_PATH_KEY;
-import java.text.DecimalFormat;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
@@ -130,7 +129,7 @@ public class CacheAwareLoadBalancer extends
StochasticLoadBalancer {
int regionSizeMB = (int) rm.getRegionSizeMB().get(Size.Unit.MEGABYTE);
rload.add(new BalancerRegionLoad(rm));
- // Maintain a map of region and it's total size. This is needed to
calculate the cache
+ // Maintain a map of region and its total size. This is needed to
calculate the cache
// ratios for the regions cached on old region servers
regionCacheRatioOnCurrentServerMap.put(regionEncodedName, new
Pair<>(sn, regionSizeMB));
loads.put(regionEncodedName, rload);
@@ -285,9 +284,6 @@ public class CacheAwareLoadBalancer extends
StochasticLoadBalancer {
return false;
}
- DecimalFormat df = new DecimalFormat("#");
- df.setMaximumFractionDigits(4);
-
float cacheRatioDiffThreshold = 0.6f;
// Conditions for moving the region
@@ -307,7 +303,7 @@ public class CacheAwareLoadBalancer extends
StochasticLoadBalancer {
LOG.debug(
"Region {} moved from {} to {} as the region is cached {} equally
on both servers",
cluster.regions[regionIndex].getEncodedName(),
cluster.servers[currentServerIndex],
- cluster.servers[oldServerIndex],
df.format(cacheRatioOnCurrentServer));
+ cluster.servers[oldServerIndex], cacheRatioOnCurrentServer);
}
return true;
}
@@ -324,8 +320,7 @@ public class CacheAwareLoadBalancer extends
StochasticLoadBalancer {
"Region {} moved from {} to {} as region cache ratio {} is better
than the current "
+ "cache ratio {}",
cluster.regions[regionIndex].getEncodedName(),
cluster.servers[currentServerIndex],
- cluster.servers[oldServerIndex], cacheRatioOnCurrentServer,
- df.format(cacheRatioOnCurrentServer));
+ cluster.servers[oldServerIndex], cacheRatioOnOldServer,
cacheRatioOnCurrentServer);
}
return true;
}
@@ -334,8 +329,7 @@ public class CacheAwareLoadBalancer extends
StochasticLoadBalancer {
LOG.debug(
"Region {} not moved from {} to {} with current cache ratio {} and
old cache ratio {}",
cluster.regions[regionIndex], cluster.servers[currentServerIndex],
- cluster.servers[oldServerIndex], cacheRatioOnCurrentServer,
- df.format(cacheRatioOnCurrentServer));
+ cluster.servers[oldServerIndex], cacheRatioOnCurrentServer,
cacheRatioOnOldServer);
}
return false;
}
@@ -391,7 +385,7 @@ public class CacheAwareLoadBalancer extends
StochasticLoadBalancer {
if (LOG.isDebugEnabled()) {
LOG.debug(
"CacheAwareSkewnessCandidateGenerator: Region {} moved from {} to
{} as it "
- + "was hosted their earlier",
+ + "was hosted there earlier",
regionEncodedName, cluster.servers[thisServer].getHostname(),
cluster.servers[otherServer].getHostname());
}