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
FieldsModifier and TypeFieldDescriptionprivate doubleprivate double[]private boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidapplyCostsChange(Consumer<double[]> consumer) private static doublecomputeCost(double[] stats) (package private) doublecost()static doublegetMaxSkew(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 doublegetMinSkew(double total, double numServers) Return the min skew of distributionprivate static doublegetSum(double[] stats) (package private) voidprepare(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 aConsumeras parameter, where we will pass the actual cost array in, so you can change the element of the cost array in theConsumerimplementation. 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
-