remove short circuited healing optimization (#12796)

this healing optimization caused multiple
regressions in healing

- delete-markers incorrectly missing
  heal and returning incorrect healing
  results to client.

- missing individual 'parts' such
  as for restored object or simply
  for all objects just missing few parts.

This optimization is not necessary, we
should proceed to verify all cases possible
not just when metadata is inconsistent.
This commit is contained in:
Harshavardhana 2021-07-26 16:51:09 -07:00 committed by GitHub
parent 0c666379fe
commit a9d9b520ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 39 deletions

View File

@ -189,35 +189,6 @@ func getLatestFileInfo(ctx context.Context, partsMetadata []FileInfo, errs []err
return latestFileInfo, nil
}
// fileInfoConsistent whether all fileinfos are consistent with each other.
// Will return false if any fileinfo mismatches.
func fileInfoConsistent(ctx context.Context, partsMetadata []FileInfo, errs []error) bool {
// There should be atleast half correct entries, if not return failure
if reducedErr := reduceReadQuorumErrs(ctx, errs, nil, len(partsMetadata)/2); reducedErr != nil {
return false
}
if len(partsMetadata) == 1 {
return true
}
// Reference
ref := partsMetadata[0]
if !ref.IsValid() {
return false
}
for _, meta := range partsMetadata[1:] {
if !meta.IsValid() {
return false
}
if !meta.ModTime.Equal(ref.ModTime) {
return false
}
if meta.DataDir != ref.DataDir {
return false
}
}
return true
}
// disksWithAllParts - This function needs to be called with
// []StorageAPI returned by listOnlineDisks. Returns,
//

View File

@ -907,7 +907,7 @@ func (er erasureObjects) HealObject(ctx context.Context, bucket, object, version
// Perform quick read without lock.
// This allows to quickly check if all is ok or all are missing.
partsMetadata, errs := readAllFileInfo(healCtx, storageDisks, bucket, object, versionID, false)
_, errs := readAllFileInfo(healCtx, storageDisks, bucket, object, versionID, false)
if isAllNotFound(errs) {
err = toObjectErr(errFileNotFound, bucket, object)
if versionID != "" {
@ -918,15 +918,6 @@ func (er erasureObjects) HealObject(ctx context.Context, bucket, object, version
errs, bucket, object, versionID), err
}
// Return early if all ok and not deep scanning.
if opts.ScanMode == madmin.HealNormalScan && fileInfoConsistent(ctx, partsMetadata, errs) {
fi, err := getLatestFileInfo(ctx, partsMetadata, errs)
if err == nil && fi.VersionID == versionID {
return er.defaultHealResult(fi, storageDisks, storageEndpoints,
errs, bucket, object, versionID), nil
}
}
// Heal the object.
return er.healObject(healCtx, bucket, object, versionID, opts)
}