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

Fix(backup): Fix rename operation in s3 handler #7669

Merged
merged 1 commit into from
Mar 30, 2021
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
4 changes: 3 additions & 1 deletion worker/backup_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,8 @@ func (h *s3Handler) CreateFile(path string) (io.WriteCloser, error) {
}

func (h *s3Handler) Rename(srcPath, dstPath string) error {
srcPath = h.getObjectPath(srcPath)
dstPath = h.getObjectPath(dstPath)
src := minio.NewSourceInfo(h.bucketName, srcPath, nil)
dst, err := minio.NewDestinationInfo(h.bucketName, dstPath, nil, nil)
if err != nil {
Expand All @@ -759,7 +761,7 @@ func (h *s3Handler) Rename(srcPath, dstPath string) error {
// We try copying 100 times, if it still fails, then the user should manually rename.
err = x.RetryUntilSuccess(100, time.Second, func() error {
if err := h.mc.CopyObject(dst, src); err != nil {
return errors.Wrapf(err, "While renaming object in s3, copy failed ")
return errors.Wrapf(err, "While renaming object in s3, copy failed")
}
return nil
})
Expand Down