diff --git a/internal/querycoordv2/balance/multi_target_balance.go b/internal/querycoordv2/balance/multi_target_balance.go index 21f9b9df95..d8e21c6806 100644 --- a/internal/querycoordv2/balance/multi_target_balance.go +++ b/internal/querycoordv2/balance/multi_target_balance.go @@ -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 diff --git a/pkg/util/paramtable/component_param.go b/pkg/util/paramtable/component_param.go index e4c5800eee..df37b7fb26 100644 --- a/pkg/util/paramtable/component_param.go +++ b/pkg/util/paramtable/component_param.go @@ -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)