From f497caf2cb30058196b5db241ea9749ee6e7029b Mon Sep 17 00:00:00 2001 From: huanghaoyuanhhy Date: Tue, 17 Dec 2024 14:49:23 +0800 Subject: [PATCH] use segment info after flush (#482) Signed-off-by: huanghaoyuanhhy --- core/backup_impl_create_backup.go | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/core/backup_impl_create_backup.go b/core/backup_impl_create_backup.go index eb2034d..448e2a7 100644 --- a/core/backup_impl_create_backup.go +++ b/core/backup_impl_create_backup.go @@ -414,7 +414,6 @@ func (b *BackupContext) backupCollectionPrepare(ctx context.Context, backupInfo zap.Uint64("BackupTimestamp", collectionBackup.BackupTimestamp), zap.Any("channelCPs", channelCPs)) - flushSegmentIDs := append(newSealedSegmentIDs, flushedSegmentIDs...) segmentEntitiesAfterFlush, err := b.getMilvusClient().GetPersistentSegmentInfo(ctx, collectionBackup.GetDbName(), collectionBackup.GetCollectionName()) if err != nil { return err @@ -434,31 +433,8 @@ func (b *BackupContext) backupCollectionPrepare(ctx context.Context, backupInfo zap.Int64s("segmentIDsAfterFlush", segmentIDsAfterFlush), zap.Int64s("newL0SegmentsIDs", newL0SegmentsIDs)) - segmentEntities := segmentEntitiesBeforeFlush for _, seg := range segmentEntitiesAfterFlush { - if !lo.Contains(segmentIDsBeforeFlush, seg.ID) { - segmentEntities = append(segmentEntities, seg) - } - } - - // segmentIDs - unfilledSegmentIDs := make([]int64, 0) - // union of (intersection of BeforeFlushIDs and AfterFlushIDs) and flushSegmentIDs - for _, seg := range segmentEntitiesAfterFlush { - if lo.Contains(segmentIDsBeforeFlush, seg.ID) { - unfilledSegmentIDs = append(unfilledSegmentIDs, seg.ID) - } - } - for _, segID := range flushSegmentIDs { - if !lo.Contains(unfilledSegmentIDs, segID) { - unfilledSegmentIDs = append(unfilledSegmentIDs, segID) - } - } - unfilledSegmentIDs = append(unfilledSegmentIDs, newL0SegmentsIDs...) - for _, seg := range segmentEntities { - if lo.Contains(unfilledSegmentIDs, seg.ID) { - unfilledSegments = append(unfilledSegments, seg) - } + unfilledSegments = append(unfilledSegments, seg) } } else { // Flush @@ -476,10 +452,6 @@ func (b *BackupContext) backupCollectionPrepare(ctx context.Context, backupInfo } } - if err != nil { - return err - } - newSegIDs := lo.Map(unfilledSegments, func(segment *entity.Segment, _ int) int64 { return segment.ID }) log.Debug("Finished fill segment", zap.String("databaseName", collectionBackup.GetDbName()),