Class DoubleArrayCost
java.lang.Object
org.apache.hadoop.hbase.master.balancer.DoubleArrayCost
A helper class to compute a scaled cost using
DescriptiveStatistics()
.
It assumes that this is a zero sum set of costs. It assumes that the worst case possible is all
of the elements in one region server and the rest having 0.-
Field Summary
Modifier and TypeFieldDescriptionprivate double
private double[]
private boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) void
applyCostsChange
(Consumer<double[]> consumer) private static double
computeCost
(double[] stats) (package private) double
cost()
static double
getMaxSkew
(double total, double numServers) Return the max deviation of distribution Compute max as if all region servers had 0 and one had the sum of all costs.static double
getMinSkew
(double total, double numServers) Return the min skew of distributionprivate static double
getSum
(double[] stats) (package private) void
prepare
(int length)
-
Field Details
-
costs
-
costsChanged
-
cost
-
-
Constructor Details
-
DoubleArrayCost
-
-
Method Details
-
prepare
-
applyCostsChange
We do not want to introduce a getCosts method to let upper layer get the cost array directly, so here we introduce this method to take aConsumer
as parameter, where we will pass the actual cost array in, so you can change the element of the cost array in theConsumer
implementation. Usually, in prepare method, you need to fill all the elements of the cost array, while in regionMoved method, you just need to update the element for the effect region servers. -
cost
double cost() -
computeCost
-
getSum
-
getMinSkew
Return the min skew of distribution- Parameters:
total
- is total number of regions
-
getMaxSkew
Return the max deviation of distribution Compute max as if all region servers had 0 and one had the sum of all costs. This must be a zero sum cost for this to make sense.- Parameters:
total
- is total number of regions
-