[skip ci]Add comments for SegmentManager (#8087)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/8114/head
congqixia 2021-09-16 19:55:49 +08:00 committed by GitHub
parent ca2d09a167
commit 01c8341a2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import (
)
var (
// allocPool pool of Allocation, to reduce allocation of Allocation
allocPool = sync.Pool{
New: func() interface{} {
return &Allocation{}
@ -59,6 +60,8 @@ func putAllocation(a *Allocation) {
allocPool.Put(a)
}
// segmentMaxLifetime default segment max lifetime value
// TODO needs to be configurable
const segmentMaxLifetime = 24 * time.Hour
// Manager manage segment related operations.
@ -326,6 +329,7 @@ func (s *SegmentManager) estimateMaxNumOfRows(collectionID UniqueID) (int, error
return s.estimatePolicy(collMeta.Schema)
}
// DropSegment puts back all the allocation of provided segment
func (s *SegmentManager) DropSegment(ctx context.Context, segmentID UniqueID) {
sp, _ := trace.StartSpanFromContext(ctx)
defer sp.Finish()
@ -347,6 +351,7 @@ func (s *SegmentManager) DropSegment(ctx context.Context, segmentID UniqueID) {
}
}
// SealAllSegments seals all segments of provided collectionID
func (s *SegmentManager) SealAllSegments(ctx context.Context, collectionID UniqueID) ([]UniqueID, error) {
sp, _ := trace.StartSpanFromContext(ctx)
defer sp.Finish()
@ -374,6 +379,7 @@ func (s *SegmentManager) SealAllSegments(ctx context.Context, collectionID Uniqu
return ret, nil
}
// GetFlushableSegments get segment ids with Sealed State and flushable (meets flushPolicy)
func (s *SegmentManager) GetFlushableSegments(ctx context.Context, channel string,
t Timestamp) ([]UniqueID, error) {
s.mu.Lock()