@InterfaceAudience.Private final class DoubleArrayCost extends Object
org.apache.commons.math3.stat.descriptive.DescriptiveStatistics#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.Modifier and Type | Field and Description |
---|---|
private double |
cost |
private double[] |
costs |
private boolean |
costsChanged |
Constructor and Description |
---|
DoubleArrayCost() |
Modifier and Type | Method and Description |
---|---|
(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 distribution
|
private static double |
getSum(double[] stats) |
(package private) void |
prepare(int length) |
private double[] costs
private boolean costsChanged
private double cost
DoubleArrayCost()
void prepare(int length)
void applyCostsChange(Consumer<double[]> consumer)
Consumer
as parameter, where we will pass
the actual cost array in, so you can change the element of the cost array in the
Consumer
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.double cost()
private static double computeCost(double[] stats)
private static double getSum(double[] stats)
public static double getMinSkew(double total, double numServers)
total
- is total number of regionspublic static double getMaxSkew(double total, double numServers)
total
- is total number of regionsCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.