mirror of https://github.com/milvus-io/milvus.git
Signed-off-by: sunby <sunbingyi1992@gmail.com>pull/30817/head
parent
9815cf50c9
commit
ece9d273a7
|
@ -96,7 +96,7 @@ func (m *segmentCountCostModel) cost() float64 {
|
|||
return (currCost - best) / (worst - best)
|
||||
}
|
||||
|
||||
func cmpFloat(f1, f2 float64) int {
|
||||
func cmpCost(f1, f2 float64) int {
|
||||
if math.Abs(f1-f2) < params.Params.QueryCoordCfg.BalanceCostThreshold.GetAsFloat() {
|
||||
return 0
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ func (g *rowCountBasedPlanGenerator) generatePlans() []SegmentAssignPlan {
|
|||
newCluster := g.applyPlans(g.replicaNodeSegments, []SegmentAssignPlan{plan})
|
||||
newGlobalCluster := g.applyPlans(g.globalNodeSegments, []SegmentAssignPlan{plan})
|
||||
newCost := g.calClusterCost(newCluster, newGlobalCluster)
|
||||
if cmpFloat(newCost, g.currClusterCost) < 0 {
|
||||
if cmpCost(newCost, g.currClusterCost) < 0 {
|
||||
g.currClusterCost = newCost
|
||||
g.replicaNodeSegments = newCluster
|
||||
g.globalNodeSegments = newGlobalCluster
|
||||
|
@ -356,7 +356,7 @@ func (g *segmentCountBasedPlanGenerator) generatePlans() []SegmentAssignPlan {
|
|||
newCluster := g.applyPlans(g.replicaNodeSegments, []SegmentAssignPlan{plan})
|
||||
newGlobalCluster := g.applyPlans(g.globalNodeSegments, []SegmentAssignPlan{plan})
|
||||
newCost := g.calClusterCost(newCluster, newGlobalCluster)
|
||||
if cmpFloat(newCost, g.currClusterCost) < 0 {
|
||||
if cmpCost(newCost, g.currClusterCost) < 0 {
|
||||
g.currClusterCost = newCost
|
||||
g.replicaNodeSegments = newCluster
|
||||
g.globalNodeSegments = newGlobalCluster
|
||||
|
@ -440,7 +440,7 @@ func (g *randomPlanGenerator) generatePlans() []SegmentAssignPlan {
|
|||
newCluster := g.applyPlans(g.replicaNodeSegments, plans)
|
||||
newGlobalCluster := g.applyPlans(g.globalNodeSegments, plans)
|
||||
newCost := g.calClusterCost(newCluster, newGlobalCluster)
|
||||
if cmpFloat(newCost, g.currClusterCost) < 0 {
|
||||
if cmpCost(newCost, g.currClusterCost) < 0 {
|
||||
g.currClusterCost = newCost
|
||||
g.replicaNodeSegments = newCluster
|
||||
g.globalNodeSegments = newGlobalCluster
|
||||
|
|
|
@ -1606,10 +1606,10 @@ func (p *queryCoordConfig) init(base *BaseTable) {
|
|||
|
||||
p.BalanceCostThreshold = ParamItem{
|
||||
Key: "queryCoord.balanceCostThreshold",
|
||||
Version: "2.3.5",
|
||||
Version: "2.4.0",
|
||||
DefaultValue: "0.001",
|
||||
PanicIfEmpty: true,
|
||||
Doc: "the threshold of balance cost",
|
||||
Doc: "the threshold of balance cost, if the difference of cluster's cost after executing the balance plan is less than this value, the plan will not be executed",
|
||||
Export: true,
|
||||
}
|
||||
p.BalanceCostThreshold.Init(base.mgr)
|
||||
|
|
Loading…
Reference in New Issue