@InterfaceAudience.Private abstract class RegionReplicaGroupingCostFunction extends CostFunction
| Modifier and Type | Field and Description |
|---|---|
protected long[] |
costsPerGroup |
protected long |
maxCost |
cluster, COST_EPSILON| Constructor and Description |
|---|
RegionReplicaGroupingCostFunction() |
| Modifier and Type | Method and Description |
|---|---|
protected double |
cost() |
protected long |
costPerGroup(org.agrona.collections.Int2IntCounterMap colocatedReplicaCounts)
For each primary region, it computes the total number of replicas in the array (numReplicas)
and returns a sum of numReplicas-1 squared.
|
protected long |
getMaxCost(BalancerClusterState cluster) |
(package private) boolean |
isNeeded() |
protected abstract void |
loadCosts() |
(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.
|
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, postAction, regionMoved, scale, setMultiplierprotected long maxCost
protected long[] costsPerGroup
RegionReplicaGroupingCostFunction()
final void prepare(BalancerClusterState cluster)
CostFunctionprepare in class CostFunctionprotected abstract void loadCosts()
protected final long getMaxCost(BalancerClusterState cluster)
boolean isNeeded()
isNeeded in class CostFunctionprotected double cost()
cost in class CostFunctionprotected final long costPerGroup(org.agrona.collections.Int2IntCounterMap colocatedReplicaCounts)
colocatedReplicaCounts - a sorted array of primary regions ids for the regions hostedpublic final void updateWeight(double[] weights)
CostFunctionupdateWeight in class CostFunctionweights - the weights for every generator.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.