mirror of https://github.com/milvus-io/milvus.git
Fix alloc segment with dropped segment (#12572)
issue: #12465 Signed-off-by: sunby <bingyi.sun@zilliz.com> Co-authored-by: sunby <bingyi.sun@zilliz.com>pull/12579/head
parent
777dd95071
commit
0778e6f715
|
@ -234,8 +234,7 @@ func (s *SegmentManager) AllocSegment(ctx context.Context, collectionID UniqueID
|
|||
log.Warn("Failed to get seginfo from meta", zap.Int64("id", segmentID))
|
||||
continue
|
||||
}
|
||||
if segment.State == commonpb.SegmentState_Sealed || segment.CollectionID != collectionID ||
|
||||
segment.PartitionID != partitionID || segment.InsertChannel != channelName {
|
||||
if !satisfy(segment, collectionID, partitionID, channelName) || !isGrowing(segment) {
|
||||
continue
|
||||
}
|
||||
segments = append(segments, segment)
|
||||
|
@ -277,6 +276,15 @@ func (s *SegmentManager) AllocSegment(ctx context.Context, collectionID UniqueID
|
|||
return allocations, nil
|
||||
}
|
||||
|
||||
func satisfy(segment *SegmentInfo, collectionID, partitionID UniqueID, channel string) bool {
|
||||
return segment.GetCollectionID() == collectionID && segment.GetPartitionID() == partitionID &&
|
||||
segment.GetInsertChannel() == channel
|
||||
}
|
||||
|
||||
func isGrowing(segment *SegmentInfo) bool {
|
||||
return segment.GetState() == commonpb.SegmentState_Growing
|
||||
}
|
||||
|
||||
func (s *SegmentManager) genExpireTs(ctx context.Context) (Timestamp, error) {
|
||||
ts, err := s.allocator.allocTimestamp(ctx)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue