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

@@ -474,9 +474,12 @@ func (sys *S3PeerSys) DeleteBucket(ctx context.Context, bucket string, opts Dele
perPoolErrs = append(perPoolErrs, errs[i])
}
}
if poolErr := reduceWriteQuorumErrs(ctx, perPoolErrs, bucketOpIgnoredErrs, len(perPoolErrs)/2+1); poolErr != nil && poolErr != errVolumeNotFound {
// re-create successful deletes, since we are return an error.
sys.MakeBucket(ctx, bucket, MakeBucketOptions{})
poolErr := reduceWriteQuorumErrs(ctx, perPoolErrs, bucketOpIgnoredErrs, len(perPoolErrs)/2+1)
if poolErr != nil && !errors.Is(poolErr, errVolumeNotFound) {
if !opts.NoRecreate {
// re-create successful deletes, since we are return an error.
sys.MakeBucket(ctx, bucket, MakeBucketOptions{})
}
return toObjectErr(poolErr, bucket)
}
}