From c61dd16a1eb68a4e5916a1880a148cbd64670e73 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 27 Mar 2024 20:18:15 -0700 Subject: [PATCH] fix: avoid fan-out DeletePrefix calls for batch-expire and ILM (#19365) --- cmd/batch-expire.go | 3 ++- cmd/data-scanner.go | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/batch-expire.go b/cmd/batch-expire.go index e6869d620..7360a76c0 100644 --- a/cmd/batch-expire.go +++ b/cmd/batch-expire.go @@ -428,7 +428,8 @@ func batchObjsForDelete(ctx context.Context, r *BatchJobExpire, ri *batchJobInfo } stopFn := globalBatchJobsMetrics.trace(batchJobMetricExpire, ri.JobID, attempts) _, err := api.DeleteObject(ctx, exp.Bucket, encodeDirObject(exp.Name), ObjectOptions{ - DeletePrefix: true, + DeletePrefix: true, + DeletePrefixObject: true, // use prefix delete on exact object (this is an optimization to avoid fan-out calls) }) if err != nil { stopFn(exp, err) diff --git a/cmd/data-scanner.go b/cmd/data-scanner.go index b96df6a54..6099f29df 100644 --- a/cmd/data-scanner.go +++ b/cmd/data-scanner.go @@ -1221,6 +1221,8 @@ func applyExpiryOnNonTransitionedObjects(ctx context.Context, objLayer ObjectLay if lcEvent.Action.DeleteAll() { opts.DeletePrefix = true + // use prefix delete on exact object (this is an optimization to avoid fan-out calls) + opts.DeletePrefixObject = true } var ( dobj ObjectInfo