avoid double MRF heal when there is versions disparity (#18585)

This commit is contained in:
Harshavardhana 2023-12-04 11:13:50 -08:00 committed by GitHub
parent e98172d72d
commit e7c144eeac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 17 deletions

View File

@ -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 if !opts.Speedtest && !versionsDisparity {
for _, disk := range onlineDisks { // Check if there is any offline disk and add it to the MRF list
if disk != nil && disk.IsOnline() { for _, disk := range onlineDisks {
continue 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++ { for i := 0; i < len(onlineDisks); i++ {

View File

@ -1531,18 +1531,21 @@ func (er erasureObjects) putObject(ctx context.Context, bucket string, object st
// For speedtest objects do not attempt to heal them. // For speedtest objects do not attempt to heal them.
if !opts.Speedtest { if !opts.Speedtest {
// Whether a disk was initially or becomes offline // When there is versions disparity we are healing
// during this upload, send it to the MRF list. // the content implicitly for all versions, we can
for i := 0; i < len(onlineDisks); i++ { // avoid triggering another MRF heal for offline drives.
if onlineDisks[i] != nil && onlineDisks[i].IsOnline() { if !versionsDisparity {
continue // 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
} }
} else {
er.addPartial(bucket, object, fi.VersionID)
break
}
if versionsDisparity {
globalMRFState.addPartialOp(partialOperation{ globalMRFState.addPartialOp(partialOperation{
bucket: bucket, bucket: bucket,
object: object, object: object,