mirror of https://github.com/milvus-io/milvus.git
[skip ci]Add comments for SegmentManager (#8087)
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/8114/head
parent
ca2d09a167
commit
01c8341a2e
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue