From bc7c0d86241027c13ec9eca796254dcc48e056cc Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 18 Aug 2023 09:36:23 -0700 Subject: [PATCH] if object is a delete marker it must skip tags filter in ILM (#17861) --- docs/bucket/lifecycle/README.md | 6 +++++- internal/bucket/lifecycle/lifecycle.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/bucket/lifecycle/README.md b/docs/bucket/lifecycle/README.md index 34c84d3a9..9a5b2c873 100644 --- a/docs/bucket/lifecycle/README.md +++ b/docs/bucket/lifecycle/README.md @@ -134,7 +134,11 @@ Note: This rule has an implicit zero NoncurrentDays, which makes the expiry of t #### 3.2.b Automatic removal of all versions (MinIO only extension) This is available only on MinIO as an extension to the Expiration feature. The following rule makes it possible to remove all versions of an object under -the prefix `user-uploads/` as soon as the latest object satisfies the expiration criteria. +the prefix `user-uploads/` as soon as the latest object satisfies the expiration criteria. + +> NOTE: If the latest object is a delete marker then filtering based on `Filter.Tags` is ignored and +> if the DELETE marker modTime satisfies the `Expiration.Days` then all versions of the object are +> immediately purged. ``` { diff --git a/internal/bucket/lifecycle/lifecycle.go b/internal/bucket/lifecycle/lifecycle.go index 25d5b2a32..0d47da36f 100644 --- a/internal/bucket/lifecycle/lifecycle.go +++ b/internal/bucket/lifecycle/lifecycle.go @@ -261,7 +261,7 @@ func (lc Lifecycle) FilterRules(obj ObjectOpts) []Rule { if !strings.HasPrefix(obj.Name, rule.GetPrefix()) { continue } - if !rule.Filter.TestTags(obj.UserTags) { + if !obj.DeleteMarker && !rule.Filter.TestTags(obj.UserTags) { continue } rules = append(rules, rule)