fix: dangling objects honor parityBlocks instead of dataBlocks (#19019)

Bonus: do not recreate buckets if NoRecreate is asked.
This commit is contained in:
Harshavardhana
2024-02-08 15:22:16 -08:00
committed by GitHub
parent 6005ad3d48
commit 404d8b3084
4 changed files with 11 additions and 20 deletions

View File

@@ -961,24 +961,18 @@ func isObjectDangling(metaArr []FileInfo, errs []error, dataErrs []error) (valid
return validMeta, notFoundMetaErrs > dataBlocks
}
quorum := validMeta.Erasure.DataBlocks
if validMeta.Erasure.DataBlocks == validMeta.Erasure.ParityBlocks {
quorum++
}
// TODO: It is possible to replay the object via just single
// xl.meta file, considering quorum number of data-dirs are still
// present on other drives.
//
// However this requires a bit of a rewrite, leave this up for
// future work.
if notFoundMetaErrs > 0 && notFoundMetaErrs >= quorum {
if notFoundMetaErrs > 0 && notFoundMetaErrs > validMeta.Erasure.ParityBlocks {
// All xl.meta is beyond data blocks missing, this is dangling
return validMeta, true
}
if !validMeta.IsRemote() && notFoundPartsErrs > 0 && notFoundPartsErrs >= quorum {
if !validMeta.IsRemote() && notFoundPartsErrs > 0 && notFoundPartsErrs > validMeta.Erasure.ParityBlocks {
// All data-dir is beyond data blocks missing, this is dangling
return validMeta, true
}