diff --git a/internal/datacoord/segment_manager.go b/internal/datacoord/segment_manager.go index fb9cb58332..9671b92ad4 100644 --- a/internal/datacoord/segment_manager.go +++ b/internal/datacoord/segment_manager.go @@ -67,15 +67,15 @@ const segmentMaxLifetime = 24 * time.Hour // Manager manage segment related operations. type Manager interface { - // AllocSegment allocate rows and record the allocation. + // AllocSegment allocates rows and record the allocation. AllocSegment(ctx context.Context, collectionID, partitionID UniqueID, channelName string, requestRows int64) ([]*Allocation, error) - // DropSegment drop the segment from allocator. + // DropSegment drops the segment from manager. DropSegment(ctx context.Context, segmentID UniqueID) - // SealAllSegments sealed all segmetns of collection with collectionID and return sealed segments + // SealAllSegments seals all segments of collection with collectionID and return sealed segments SealAllSegments(ctx context.Context, collectionID UniqueID) ([]UniqueID, error) - // GetFlushableSegments return flushable segment ids + // GetFlushableSegments returns flushable segment ids GetFlushableSegments(ctx context.Context, channel string, ts Timestamp) ([]UniqueID, error) - // ExpireAllocations notify segment status to expire old allocations + // ExpireAllocations notifies segment status to expire old allocations ExpireAllocations(channel string, ts Timestamp) error } @@ -341,7 +341,7 @@ func (s *SegmentManager) estimateMaxNumOfRows(collectionID UniqueID) (int, error return s.estimatePolicy(collMeta.Schema) } -// DropSegment puts back all the allocation of provided segment +// DropSegment drop the segment from manager. func (s *SegmentManager) DropSegment(ctx context.Context, segmentID UniqueID) { sp, _ := trace.StartSpanFromContext(ctx) defer sp.Finish() @@ -356,6 +356,7 @@ func (s *SegmentManager) DropSegment(ctx context.Context, segmentID UniqueID) { segment := s.meta.GetSegment(segmentID) if segment == nil { log.Warn("failed to get segment", zap.Int64("id", segmentID)) + return } s.meta.SetAllocations(segmentID, []*Allocation{}) for _, allocation := range segment.allocations { @@ -363,7 +364,7 @@ func (s *SegmentManager) DropSegment(ctx context.Context, segmentID UniqueID) { } } -// SealAllSegments seals all segments of provided collectionID +// SealAllSegments seals all segmetns of collection with collectionID and return sealed segments func (s *SegmentManager) SealAllSegments(ctx context.Context, collectionID UniqueID) ([]UniqueID, error) { sp, _ := trace.StartSpanFromContext(ctx) defer sp.Finish()