mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-01 19:39:21 +08:00
enhance: Provide secondary index critria when filter leaderview (#37777)
Related to #37630 --------- Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
3d28d99411
commit
6d86b9022e
@ -325,7 +325,9 @@ func (ob *CollectionObserver) observePartitionLoadStatus(ctx context.Context, pa
|
||||
}
|
||||
subChannelCount := loadedCount
|
||||
for _, segment := range segmentTargets {
|
||||
views := ob.dist.LeaderViewManager.GetByFilter(meta.WithSegment2LeaderView(segment.GetID(), false))
|
||||
views := ob.dist.LeaderViewManager.GetByFilter(
|
||||
meta.WithChannelName2LeaderView(segment.GetInsertChannel()),
|
||||
meta.WithSegment2LeaderView(segment.GetID(), false))
|
||||
nodes := lo.Map(views, func(view *meta.LeaderView, _ int) int64 { return view.ID })
|
||||
group := utils.GroupNodesByReplica(ob.meta.ReplicaManager, partition.GetCollectionID(), nodes)
|
||||
loadedCount += len(group)
|
||||
|
@ -124,7 +124,9 @@ func (action *SegmentAction) IsFinished(distMgr *meta.DistributionManager) bool
|
||||
}
|
||||
|
||||
// segment found in leader view
|
||||
views := distMgr.LeaderViewManager.GetByFilter(meta.WithSegment2LeaderView(action.SegmentID, false))
|
||||
views := distMgr.LeaderViewManager.GetByFilter(
|
||||
meta.WithChannelName2LeaderView(action.Shard),
|
||||
meta.WithSegment2LeaderView(action.SegmentID, false))
|
||||
if len(views) == 0 {
|
||||
return false
|
||||
}
|
||||
|
@ -351,7 +351,9 @@ func (scheduler *taskScheduler) preAdd(task Task) error {
|
||||
taskType := GetTaskType(task)
|
||||
|
||||
if taskType == TaskTypeMove {
|
||||
views := scheduler.distMgr.LeaderViewManager.GetByFilter(meta.WithSegment2LeaderView(task.SegmentID(), false))
|
||||
views := scheduler.distMgr.LeaderViewManager.GetByFilter(
|
||||
meta.WithChannelName2LeaderView(task.Shard()),
|
||||
meta.WithSegment2LeaderView(task.SegmentID(), false))
|
||||
if len(views) == 0 {
|
||||
return merr.WrapErrServiceInternal("segment's delegator not found, stop balancing")
|
||||
}
|
||||
|
@ -478,6 +478,7 @@ func (suite *TaskSuite) TestLoadSegmentTask() {
|
||||
ID: targetNode,
|
||||
CollectionID: suite.collection,
|
||||
Segments: map[int64]*querypb.SegmentDist{},
|
||||
Channel: channel.ChannelName,
|
||||
}
|
||||
for _, segment := range suite.loadSegments {
|
||||
view.Segments[segment] = &querypb.SegmentDist{NodeID: targetNode, Version: 0}
|
||||
@ -577,6 +578,7 @@ func (suite *TaskSuite) TestLoadSegmentTaskNotIndex() {
|
||||
ID: targetNode,
|
||||
CollectionID: suite.collection,
|
||||
Segments: map[int64]*querypb.SegmentDist{},
|
||||
Channel: channel.ChannelName,
|
||||
}
|
||||
for _, segment := range suite.loadSegments {
|
||||
view.Segments[segment] = &querypb.SegmentDist{NodeID: targetNode, Version: 0}
|
||||
@ -1141,6 +1143,7 @@ func (suite *TaskSuite) TestSegmentTaskStale() {
|
||||
ID: targetNode,
|
||||
CollectionID: suite.collection,
|
||||
Segments: map[int64]*querypb.SegmentDist{},
|
||||
Channel: channel.ChannelName,
|
||||
}
|
||||
for _, segment := range suite.loadSegments[1:] {
|
||||
view.Segments[segment] = &querypb.SegmentDist{NodeID: targetNode, Version: 0}
|
||||
|
Loading…
Reference in New Issue
Block a user