From 182ad295d8a670e3db3dac479a0271f9a29d57be Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Thu, 26 Apr 2018 11:21:10 -0700 Subject: [PATCH] Quit calculating difference for any listing error (#2440) If we have any listing problem, we should stop comparing difference between source & target lists because it is already so hard to know what mc should do next. So, let's inform users and let them deal with the problem. --- cmd/difference.go | 6 ++---- cmd/mirror-main.go | 3 +-- cmd/mirror-url.go | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cmd/difference.go b/cmd/difference.go index 40100f29..699b088d 100644 --- a/cmd/difference.go +++ b/cmd/difference.go @@ -98,14 +98,12 @@ func difference(sourceClnt, targetClnt Client, sourceURL, targetURL string, isRe if !srcEOF && srcCtnt.Err != nil { diffCh <- diffMessage{Error: srcCtnt.Err.Trace(sourceURL, targetURL)} - srcCtnt, srcOk = <-srcCh - continue + return } if !tgtEOF && tgtCtnt.Err != nil { diffCh <- diffMessage{Error: tgtCtnt.Err.Trace(sourceURL, targetURL)} - tgtCtnt, tgtOk = <-tgtCh - continue + return } // If source doesn't have objects anymore, comparison becomes obvious diff --git a/cmd/mirror-main.go b/cmd/mirror-main.go index c8a5d131..d215a786 100644 --- a/cmd/mirror-main.go +++ b/cmd/mirror-main.go @@ -581,15 +581,14 @@ func (mj *mirrorJob) mirror(ctx context.Context, cancelMirror context.CancelFunc switch err.ToGoError().(type) { case BrokenSymlink, TooManyLevelsSymlink, PathNotFound, PathInsufficientPermission, ObjectOnGlacier: + errorIf(err, "Unable to perform a mirror action.") continue case deleteNotAllowedErr, overwriteNotAllowedErr: errorIf(err, "Unable to perform a mirror action.") continue } - return err.Trace() } - } } diff --git a/cmd/mirror-url.go b/cmd/mirror-url.go index f5e85ac8..f8ccbf9d 100644 --- a/cmd/mirror-url.go +++ b/cmd/mirror-url.go @@ -117,7 +117,7 @@ func deltaSourceTarget(sourceURL, targetURL string, isFake, isOverwrite, isRemov if diffMsg.Error != nil { // Send all errors through the channel URLsCh <- URLs{Error: diffMsg.Error} - continue + return } srcSuffix := strings.TrimPrefix(diffMsg.FirstURL, sourceURL)