diff --git a/internal/querycoordv2/checkers/segment_checker.go b/internal/querycoordv2/checkers/segment_checker.go index 5a9a499a60..e9d0f25c5f 100644 --- a/internal/querycoordv2/checkers/segment_checker.go +++ b/internal/querycoordv2/checkers/segment_checker.go @@ -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)