fix: [2.5] querycoord panic in cornor case (#40058)

issue: #40050 
pr: #40057

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
This commit is contained in:
wei liu 2025-02-21 11:19:58 +08:00 committed by GitHub
parent b7c631f0b7
commit e42c944e04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -369,6 +369,9 @@ func (c *SegmentChecker) filterExistedOnLeader(replica *meta.Replica, segments [
}
view := c.dist.LeaderViewManager.GetLeaderShardView(leaderID, s.GetInsertChannel())
if view == nil {
continue
}
seg, ok := view.Segments[s.GetID()]
if ok && seg.NodeID == s.Node {
// if this segment is serving on leader, do not remove it for search available
@ -388,6 +391,9 @@ func (c *SegmentChecker) filterSegmentInUse(ctx context.Context, replica *meta.R
}
view := c.dist.LeaderViewManager.GetLeaderShardView(leaderID, s.GetInsertChannel())
if view == nil {
continue
}
currentTargetVersion := c.targetMgr.GetCollectionTargetVersion(ctx, s.CollectionID, meta.CurrentTarget)
partition := c.meta.CollectionManager.GetPartition(ctx, s.PartitionID)