Skip to content

Commit

Permalink
Fix duplicated copy bug
Browse files Browse the repository at this point in the history
Signed-off-by: wayblink <[email protected]>
  • Loading branch information
wayblink committed Mar 13, 2024
1 parent 8c34a47 commit 7b7c7b1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions core/backup_impl_create_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ type collectionStruct struct {

// parse collections to backup
// For backward compatibility:
// 1,parse dbCollections first,
// 2,if dbCollections not set, use collectionNames
//
// 1,parse dbCollections first,
// 2,if dbCollections not set, use collectionNames
func (b *BackupContext) parseBackupCollections(request *backuppb.CreateBackupRequest) ([]collectionStruct, error) {
log.Debug("Request collection names",
zap.Strings("request_collection_names", request.GetCollectionNames()),
Expand Down Expand Up @@ -493,7 +494,9 @@ func (b *BackupContext) backupCollectionExecute(ctx context.Context, levelInfo *
log.Info("backupCollectionExecute", zap.Any("collectionMeta", collectionBackup.String()))
var segmentBackupInfos []*backuppb.SegmentBackupInfo
for _, seg := range levelInfo.segmentLevel.Infos {
segmentBackupInfos = append(segmentBackupInfos, seg)
if seg.CollectionId == collectionBackup.GetCollectionId() {
segmentBackupInfos = append(segmentBackupInfos, seg)
}
}
log.Info("Begin copy data",
zap.String("dbName", collectionBackup.GetDbName()),
Expand Down Expand Up @@ -629,9 +632,10 @@ func (b *BackupContext) executeCreateBackup(ctx context.Context, request *backup

if !request.GetMetaOnly() {
for _, collection := range toBackupCollectionInfos {
collectionClone := collection
log.Info("before backupCollectionExecute", zap.String("collection", collection.CollectionName))
job := func(ctx context.Context) error {
err := b.backupCollectionExecute(ctx, levelInfo, collection)
err := b.backupCollectionExecute(ctx, levelInfo, collectionClone)
return err
}
jobId := b.getBackupCollectionWorkerPool().SubmitWithId(job)
Expand Down Expand Up @@ -709,7 +713,7 @@ func (b *BackupContext) copySegments(ctx context.Context, segments []*backuppb.S
zap.Int64("partition_id", segment.GetPartitionId()),
zap.Int64("segment_id", segment.GetSegmentId()),
zap.Int64("group_id", segment.GetGroupId()))
log.Debug("copy segment")
log.Info("copy segment")
_, err := b.fillSegmentBackupInfo(ctx, levelInfo, segment)
if err != nil {
log.Error("Fail to fill segment backup info", zap.Error(err))
Expand Down

0 comments on commit 7b7c7b1

Please sign in to comment.