Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check already copied files and skip them in restore copy #69

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pkg/proc/interaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,15 @@ func ProcessCopyExtended(msg message.CopyMessage, s storage.StorageInteractor, c
return err
}

copied, err := s.ListPath(msg.Name)
if err != nil {
return err
}
copiedSizes := make(map[string]int64)
for _, c := range copied {
copiedSizes[c.Path] = c.Size
}

var failed []*object.ObjectInfo
retryCount := 0
for len(objectMetas) > 0 && retryCount < 10 {
Expand All @@ -241,6 +250,11 @@ func ProcessCopyExtended(msg message.CopyMessage, s storage.StorageInteractor, c
path := strings.TrimPrefix(objectMetas[i].Path, instanceCnf.StorageCnf.StoragePrefix)
reworked := ReworkFileName(path)
if _, ok := vi[reworked]; !ok {
ylogger.Zero.Debug().Str("object path", objectMetas[i].Path).Msg("not in virtual index, skipping...")
continue
}
if size, ok := copiedSizes[objectMetas[i].Path]; ok && size == objectMetas[i].Size {
ylogger.Zero.Debug().Str("object path", objectMetas[i].Path).Int64("object size", objectMetas[i].Size).Msg("already copied, skipping...")
continue
}

Expand Down
Loading