From e7c144eeac72009facad20b4cd980b6b9a35d008 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 4 Dec 2023 11:13:50 -0800 Subject: [PATCH] avoid double MRF heal when there is versions disparity (#18585) --- cmd/erasure-multipart.go | 14 ++++++++------ cmd/erasure-object.go | 25 ++++++++++++++----------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/cmd/erasure-multipart.go b/cmd/erasure-multipart.go index dec06faf3..0ae12d56c 100644 --- a/cmd/erasure-multipart.go +++ b/cmd/erasure-multipart.go @@ -1290,13 +1290,15 @@ func (er erasureObjects) CompleteMultipartUpload(ctx context.Context, bucket str }) } - // Check if there is any offline disk and add it to the MRF list - for _, disk := range onlineDisks { - if disk != nil && disk.IsOnline() { - continue + if !opts.Speedtest && !versionsDisparity { + // Check if there is any offline disk and add it to the MRF list + for _, disk := range onlineDisks { + if disk != nil && disk.IsOnline() { + continue + } + er.addPartial(bucket, object, fi.VersionID) + break } - er.addPartial(bucket, object, fi.VersionID) - break } for i := 0; i < len(onlineDisks); i++ { diff --git a/cmd/erasure-object.go b/cmd/erasure-object.go index 13ca70395..f096f2463 100644 --- a/cmd/erasure-object.go +++ b/cmd/erasure-object.go @@ -1531,18 +1531,21 @@ func (er erasureObjects) putObject(ctx context.Context, bucket string, object st // For speedtest objects do not attempt to heal them. if !opts.Speedtest { - // Whether a disk was initially or becomes offline - // during this upload, send it to the MRF list. - for i := 0; i < len(onlineDisks); i++ { - if onlineDisks[i] != nil && onlineDisks[i].IsOnline() { - continue + // When there is versions disparity we are healing + // the content implicitly for all versions, we can + // avoid triggering another MRF heal for offline drives. + if !versionsDisparity { + // Whether a disk was initially or becomes offline + // during this upload, send it to the MRF list. + for i := 0; i < len(onlineDisks); i++ { + if onlineDisks[i] != nil && onlineDisks[i].IsOnline() { + continue + } + + er.addPartial(bucket, object, fi.VersionID) + break } - - er.addPartial(bucket, object, fi.VersionID) - break - } - - if versionsDisparity { + } else { globalMRFState.addPartialOp(partialOperation{ bucket: bucket, object: object,