From 15a75bd79b692907ab00a67c16c19fb00f905862 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 14 Feb 2023 07:22:08 -0800 Subject: [PATCH] ignore preconditionFailed error in batch replication (#16615) --- cmd/batch-handlers.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/batch-handlers.go b/cmd/batch-handlers.go index b13aa3437..b8c7f789c 100644 --- a/cmd/batch-handlers.go +++ b/cmd/batch-handlers.go @@ -671,9 +671,12 @@ func (r *BatchJobReplicateV1) Start(ctx context.Context, api ObjectLayer, job Ba stopFn := globalBatchJobsMetrics.trace(batchReplicationMetricObject, job.ID, attempts, result) success := true if err := r.ReplicateToTarget(ctx, api, c, result, retry); err != nil { + if miniogo.ToErrorResponse(err).Code == "PreconditionFailed" { + // pre-condition failed means we already have the object copied over. + return + } + // object must be deleted concurrently, allow these failures but do not count them if isErrVersionNotFound(err) || isErrObjectNotFound(err) { - // object must be deleted concurrently, allow - // these failures but do not count them return } stopFn(err)