@InterfaceAudience.Private abstract class LocalityBasedCostFunction extends CostFunction
HStoreFiles are located.| Modifier and Type | Field and Description |
|---|---|
private double |
bestLocality |
private double |
locality |
private BalancerClusterState.LocalityType |
type |
cluster, COST_EPSILON| Constructor and Description |
|---|
LocalityBasedCostFunction(org.apache.hadoop.conf.Configuration conf,
BalancerClusterState.LocalityType type,
String localityCostKey,
float defaultLocalityCost) |
| Modifier and Type | Method and Description |
|---|---|
protected double |
cost() |
private int |
getMostLocalEntityForRegion(int region) |
private double |
getWeightedLocality(int region,
int entity) |
(package private) void |
prepare(BalancerClusterState cluster)
Called once per LB invocation to give the cost function to initialize it's state, and perform
any costly calculation.
|
(package private) abstract int |
regionIndexToEntityIndex(int region)
Maps region to the current entity (server or rack) on which it is stored
|
protected void |
regionMoved(int region,
int oldServer,
int newServer) |
void |
updateWeight(double[] weights)
Add the cost of this cost function to the weight of the candidate generator that is optimized
for this cost function.
|
getMultiplier, isNeeded, postAction, scale, setMultiplierprivate final BalancerClusterState.LocalityType type
private double bestLocality
private double locality
LocalityBasedCostFunction(org.apache.hadoop.conf.Configuration conf, BalancerClusterState.LocalityType type, String localityCostKey, float defaultLocalityCost)
abstract int regionIndexToEntityIndex(int region)
void prepare(BalancerClusterState cluster)
CostFunctionprepare in class CostFunctionprotected void regionMoved(int region, int oldServer, int newServer)
regionMoved in class CostFunctionprotected final double cost()
cost in class CostFunctionprivate int getMostLocalEntityForRegion(int region)
private double getWeightedLocality(int region, int entity)
public final void updateWeight(double[] weights)
CostFunctionupdateWeight in class CostFunctionweights - the weights for every generator.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.