fix: simplify background heal and trigger heal items early (#9928)

Bonus fix during versioning merge one of the PR was missing
the offline/online disk count fix from #9801 port it correctly
over to the master branch from release.

Additionally, add versionID support for MRF

Fixes #9910
Fixes #9931
This commit is contained in:
Harshavardhana
2020-06-29 13:07:26 -07:00
parent dcf1be1256
commit b4b76717c1
16 changed files with 112 additions and 94 deletions
+26 -4
View File
@@ -667,7 +667,7 @@ func (xl xlObjects) putObject(ctx context.Context, bucket string, object string,
// during this upload, send it to the MRF list.
for i := 0; i < len(onlineDisks); i++ {
if onlineDisks[i] == nil || storageDisks[i] == nil {
xl.addPartialUpload(bucket, object)
xl.addPartial(bucket, object)
break
}
}
@@ -927,6 +927,21 @@ func (xl xlObjects) DeleteObjects(ctx context.Context, bucket string, objects []
}
}
// Check failed deletes across multiple objects
for i, object := range objects {
if deleteErrs[i] == nil {
// Check if there is any offline disk and add it to the MRF list
for _, disk := range xl.getDisks() {
if disk == nil {
// all other direct versionId references we should
// ensure no dangling file is left over.
xl.addPartial(bucket, object)
break
}
}
}
}
return deleteErrs, nil
}
@@ -973,6 +988,13 @@ func (xl xlObjects) DeleteObject(ctx context.Context, bucket, object string) (er
return toObjectErr(err, bucket, object)
}
for _, disk := range storageDisks {
if disk == nil {
xl.addPartial(bucket, object)
break
}
}
// Success.
return nil
}
@@ -999,11 +1021,11 @@ func (xl xlObjects) ListObjectsV2(ctx context.Context, bucket, prefix, continuat
return listObjectsV2Info, err
}
// Send the successful but partial upload, however ignore
// Send the successful but partial upload/delete, however ignore
// if the channel is blocked by other items.
func (xl xlObjects) addPartialUpload(bucket, key string) {
func (xl xlObjects) addPartial(bucket, object string) {
select {
case xl.mrfUploadCh <- partialUpload{bucket: bucket, object: key}:
case xl.mrfOpCh <- partialOperation{bucket: bucket, object: object}:
default:
}
}