mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
fix balance caused querycoord panic (#22486)
Signed-off-by: Wei Liu <wei.liu@zilliz.com>
This commit is contained in:
parent
34c20581f3
commit
820ec0fcd2
@ -153,6 +153,10 @@ func (b *RowCountBasedBalancer) balanceReplica(replica *meta.Replica) ([]Segment
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if len(nodesSegments) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
average := totalCnt / len(nodesSegments)
|
||||
neededRowCnt := 0
|
||||
for nodeID := range nodesSegments {
|
||||
|
||||
@ -220,11 +220,20 @@ func (suite *RowCountBasedBalancerTestSuite) TestBalance() {
|
||||
{SegmentInfo: &datapb.SegmentInfo{ID: 2, CollectionID: 1, NumOfRows: 20}, Node: 2},
|
||||
{SegmentInfo: &datapb.SegmentInfo{ID: 3, CollectionID: 1, NumOfRows: 30}, Node: 2},
|
||||
},
|
||||
10: {{SegmentInfo: &datapb.SegmentInfo{ID: 4, CollectionID: 1, NumOfRows: 30}, Node: 10}},
|
||||
},
|
||||
expectPlans: []SegmentAssignPlan{},
|
||||
expectChannelPlans: []ChannelAssignPlan{},
|
||||
},
|
||||
{
|
||||
name: "all query node not exist",
|
||||
nodes: []int64{},
|
||||
notExistedNodes: []int64{101, 102},
|
||||
segmentCnts: []int{1, 2},
|
||||
states: []session.State{session.NodeStateNormal, session.NodeStateNormal},
|
||||
distributions: map[int64][]*meta.Segment{},
|
||||
expectPlans: []SegmentAssignPlan{},
|
||||
expectChannelPlans: []ChannelAssignPlan{},
|
||||
},
|
||||
}
|
||||
|
||||
suite.mockScheduler.Mock.On("GetNodeChannelDelta", mock.Anything).Return(0)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user