ignore preconditionFailed error in batch replication (#16615)

This commit is contained in:
Harshavardhana 2023-02-14 07:22:08 -08:00 committed by GitHub
parent 74887c7372
commit 15a75bd79b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -671,9 +671,12 @@ func (r *BatchJobReplicateV1) Start(ctx context.Context, api ObjectLayer, job Ba
stopFn := globalBatchJobsMetrics.trace(batchReplicationMetricObject, job.ID, attempts, result) stopFn := globalBatchJobsMetrics.trace(batchReplicationMetricObject, job.ID, attempts, result)
success := true success := true
if err := r.ReplicateToTarget(ctx, api, c, result, retry); err != nil { 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) { if isErrVersionNotFound(err) || isErrObjectNotFound(err) {
// object must be deleted concurrently, allow
// these failures but do not count them
return return
} }
stopFn(err) stopFn(err)