This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a commit to branch branch-2.5
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.5 by this push:
new 7c0ed610f84 HBASE-29467 Redundant conditions in CostFunction.scale()
method (#7170)
7c0ed610f84 is described below
commit 7c0ed610f8406960d9b99d3da13b2947395db15a
Author: Jialun peng <[email protected]>
AuthorDate: Sun Jul 27 21:37:26 2025 +0800
HBASE-29467 Redundant conditions in CostFunction.scale() method (#7170)
The first if-block already covers all these cases, making the second
if-block completely redundant as it will never be reached with conditions that
would make it evaluate differently.
Signed-off-by: Duo Zhang <[email protected]>
Reviewied-by: Kevin Geiszler <[email protected]>
(cherry picked from commit d76bbe21cf0dfc37f740718e826b8c7ccf582c11)
---
.../java/org/apache/hadoop/hbase/master/balancer/CostFunction.java | 4 ----
1 file changed, 4 deletions(-)
diff --git
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/CostFunction.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/CostFunction.java
index 372cc54c8b2..a1acc3a85d3 100644
---
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/CostFunction.java
+++
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/CostFunction.java
@@ -100,10 +100,6 @@ abstract class CostFunction {
) {
return 0;
}
- if (max <= min || Math.abs(max - min) <= costEpsilon) {
- return 0;
- }
-
return Math.max(0d, Math.min(1d, (value - min) / (max - min)));
}