From 7260b0f9ea01e18a2d44a2bca1fdfd6ab15dab77 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 1 Oct 2018 03:03:18 -0700 Subject: [PATCH] Ignore errors during mirror (#2562) S3 lists 1000 objects in batches, but once this batch is being processed to be copied over there is no way to lock across the entire batch for mirroring. Due to this we introduce a scenario when objects might have been deleted in parallel from another application. In such a scenario simply ignore such objects and proceed to copy other files. Fixes #2537 --- cmd/mirror-main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/mirror-main.go b/cmd/mirror-main.go index e2dd19d0..2cabfcd8 100644 --- a/cmd/mirror-main.go +++ b/cmd/mirror-main.go @@ -290,9 +290,11 @@ func (mj *mirrorJob) startStatus() { // Print in new line and adjust to top so that we // don't print over the ongoing progress bar. if sURLs.SourceContent != nil { - errorIf(sURLs.Error.Trace(sURLs.SourceContent.URL.String()), - fmt.Sprintf("Failed to copy `%s`.", sURLs.SourceContent.URL.String())) - os.Exit(1) + if !isErrIgnored(sURLs.Error) { + errorIf(sURLs.Error.Trace(sURLs.SourceContent.URL.String()), + fmt.Sprintf("Failed to copy `%s`.", sURLs.SourceContent.URL.String())) + os.Exit(1) + } } else { // When sURLs.SourceContent is nil, we know that we have an error related to removing errorIf(sURLs.Error.Trace(sURLs.TargetContent.URL.String()),