mirror of
https://github.com/minio/minio.git
synced 2025-02-04 02:15:59 -05:00
make sure to pass Lifecycle if set for List filtering (#14722)
PR #14606 never really passed the Lifecycle filter down to the listing callers to ensure skipping the entries.
This commit is contained in:
parent
4ce86ff5fa
commit
e77ad3f9bb
@ -1160,11 +1160,6 @@ func (z *erasureServerPools) ListObjects(ctx context.Context, bucket, prefix, ma
|
|||||||
|
|
||||||
// Automatically remove the object/version is an expiry lifecycle rule can be applied
|
// Automatically remove the object/version is an expiry lifecycle rule can be applied
|
||||||
lc, _ := globalLifecycleSys.Get(bucket)
|
lc, _ := globalLifecycleSys.Get(bucket)
|
||||||
if lc != nil {
|
|
||||||
if !lc.HasActiveRules(prefix, true) {
|
|
||||||
lc = nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(prefix) > 0 && maxKeys == 1 && delimiter == "" && marker == "" {
|
if len(prefix) > 0 && maxKeys == 1 && delimiter == "" && marker == "" {
|
||||||
// Optimization for certain applications like
|
// Optimization for certain applications like
|
||||||
@ -1180,6 +1175,8 @@ func (z *erasureServerPools) ListObjects(ctx context.Context, bucket, prefix, ma
|
|||||||
action := evalActionFromLifecycle(ctx, *lc, objInfo, false)
|
action := evalActionFromLifecycle(ctx, *lc, objInfo, false)
|
||||||
switch action {
|
switch action {
|
||||||
case lifecycle.DeleteVersionAction, lifecycle.DeleteAction:
|
case lifecycle.DeleteVersionAction, lifecycle.DeleteAction:
|
||||||
|
fallthrough
|
||||||
|
case lifecycle.DeleteRestoredAction, lifecycle.DeleteRestoredVersionAction:
|
||||||
return loi, nil
|
return loi, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1196,6 +1193,7 @@ func (z *erasureServerPools) ListObjects(ctx context.Context, bucket, prefix, ma
|
|||||||
Marker: marker,
|
Marker: marker,
|
||||||
InclDeleted: false,
|
InclDeleted: false,
|
||||||
AskDisks: globalAPIConfig.getListQuorum(),
|
AskDisks: globalAPIConfig.getListQuorum(),
|
||||||
|
Lifecycle: lc,
|
||||||
}
|
}
|
||||||
|
|
||||||
merged, err := z.listPath(ctx, &opts)
|
merged, err := z.listPath(ctx, &opts)
|
||||||
|
@ -291,9 +291,9 @@ func (z *erasureServerPools) listMerged(ctx context.Context, o listPathOptions,
|
|||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
|
|
||||||
// Do lifecycle filtering.
|
// Do lifecycle filtering.
|
||||||
if o.lcFilter != nil {
|
if o.Lifecycle != nil {
|
||||||
filterIn := make(chan metaCacheEntry, 10)
|
filterIn := make(chan metaCacheEntry, 10)
|
||||||
go filterLifeCycle(ctx, o.Bucket, o.lcFilter, filterIn, results)
|
go filterLifeCycle(ctx, o.Bucket, o.Lifecycle, filterIn, results)
|
||||||
// Replace results.
|
// Replace results.
|
||||||
results = filterIn
|
results = filterIn
|
||||||
}
|
}
|
||||||
@ -381,6 +381,8 @@ func filterLifeCycle(ctx context.Context, bucket string, lc *lifecycle.Lifecycle
|
|||||||
action := evalActionFromLifecycle(ctx, *lc, objInfo, false)
|
action := evalActionFromLifecycle(ctx, *lc, objInfo, false)
|
||||||
switch action {
|
switch action {
|
||||||
case lifecycle.DeleteVersionAction, lifecycle.DeleteAction:
|
case lifecycle.DeleteVersionAction, lifecycle.DeleteAction:
|
||||||
|
fallthrough
|
||||||
|
case lifecycle.DeleteRestoredAction, lifecycle.DeleteRestoredVersionAction:
|
||||||
// Skip this entry.
|
// Skip this entry.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -93,13 +93,13 @@ type listPathOptions struct {
|
|||||||
// Versioned is this a ListObjectVersions call.
|
// Versioned is this a ListObjectVersions call.
|
||||||
Versioned bool
|
Versioned bool
|
||||||
|
|
||||||
// pool and set of where the cache is located.
|
// Lifecycle performs filtering based on lifecycle.
|
||||||
pool, set int
|
|
||||||
|
|
||||||
// lcFilter performs filtering based on lifecycle.
|
|
||||||
// This will filter out objects if the most recent version should be deleted by lifecycle.
|
// This will filter out objects if the most recent version should be deleted by lifecycle.
|
||||||
// Is not transferred across request calls.
|
// Is not transferred across request calls.
|
||||||
lcFilter *lifecycle.Lifecycle
|
Lifecycle *lifecycle.Lifecycle
|
||||||
|
|
||||||
|
// pool and set of where the cache is located.
|
||||||
|
pool, set int
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user