Skip to content

mirror:not overwrit target object when mirror watch #5193

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

Closed
wants to merge 4 commits into from
Closed
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
12 changes: 7 additions & 5 deletions cmd/mirror-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,21 +418,23 @@ func (mj *mirrorJob) doRemove(ctx context.Context, sURLs URLs, event EventInfo)
// doMirror - Mirror an object to multiple destination. URLs status contains a copy of sURLs and error if any.
func (mj *mirrorJob) doMirrorWatch(ctx context.Context, targetPath string, tgtSSE encrypt.ServerSide, sURLs URLs, event EventInfo) URLs {
shouldQueue := false
if !mj.opts.isOverwrite && !mj.opts.activeActive {
if !mj.opts.isOverwrite {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not related to --overwrite

targetClient, err := newClient(targetPath)
if err != nil {
// cannot create targetclient
return sURLs.WithError(err)
}
_, err = targetClient.Stat(ctx, StatOptions{sse: tgtSSE})
if err == nil {
if !sURLs.SourceContent.RetentionEnabled && !sURLs.SourceContent.LegalHoldEnabled {
if !mj.opts.activeActive && !sURLs.SourceContent.RetentionEnabled && !sURLs.SourceContent.LegalHoldEnabled {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not related to --overwrite

return sURLs.WithError(probe.NewError(ObjectAlreadyExists{}))
}
} // doesn't exist
shouldQueue = true
} else {
// doesn't exist
shouldQueue = true
}
}
if shouldQueue || mj.opts.isOverwrite || mj.opts.activeActive {
if shouldQueue || mj.opts.isOverwrite {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not related to --overwrite

// adjust total, because we want to show progress of
// the item still queued to be copied.
mj.status.Add(sURLs.SourceContent.Size)
Expand Down
Loading