diff --git a/cmd/data-scanner.go b/cmd/data-scanner.go index 59109b65f..2ebb2cebf 100644 --- a/cmd/data-scanner.go +++ b/cmd/data-scanner.go @@ -960,7 +960,7 @@ func (i *scannerItem) applyLifecycle(ctx context.Context, o ObjectLayer, oi Obje versionID := oi.VersionID rCfg, _ := globalBucketObjectLockSys.Get(i.bucket) - action := evalActionFromLifecycle(ctx, *i.lifeCycle, rCfg, oi, false) + action := evalActionFromLifecycle(ctx, *i.lifeCycle, rCfg, oi) if i.debug { if versionID != "" { console.Debugf(applyActionsLogPrefix+" lifecycle: %q (version-id=%s), Initial scan: %v\n", i.objectPath(), versionID, action) @@ -1106,9 +1106,9 @@ func (i *scannerItem) applyActions(ctx context.Context, o ObjectLayer, oi Object return size } -func evalActionFromLifecycle(ctx context.Context, lc lifecycle.Lifecycle, lr lock.Retention, obj ObjectInfo, debug bool) (action lifecycle.Action) { +func evalActionFromLifecycle(ctx context.Context, lc lifecycle.Lifecycle, lr lock.Retention, obj ObjectInfo) (action lifecycle.Action) { action = lc.ComputeAction(obj.ToLifecycleOpts()) - if debug { + if serverDebugLog { console.Debugf(applyActionsLogPrefix+" lifecycle: Secondary scan: %v\n", action) } @@ -1123,7 +1123,7 @@ func evalActionFromLifecycle(ctx context.Context, lc lifecycle.Lifecycle, lr loc return lifecycle.NoneAction } if lr.LockEnabled && enforceRetentionForDeletion(ctx, obj) { - if debug { + if serverDebugLog { if obj.VersionID != "" { console.Debugf(applyActionsLogPrefix+" lifecycle: %s v(%s) is locked, not deleting\n", obj.Name, obj.VersionID) } else { diff --git a/cmd/erasure-object.go b/cmd/erasure-object.go index ac70b1750..2ddeb745c 100644 --- a/cmd/erasure-object.go +++ b/cmd/erasure-object.go @@ -1530,7 +1530,7 @@ func (er erasureObjects) DeleteObject(ctx context.Context, bucket, object string if opts.Expiration.Expire { goi, _, err := er.getObjectInfoAndQuorum(ctx, bucket, object, opts) if err == nil { - action := evalActionFromLifecycle(ctx, *lc, rcfg, goi, false) + action := evalActionFromLifecycle(ctx, *lc, rcfg, goi) var isErr bool switch action { case lifecycle.NoneAction: diff --git a/cmd/erasure-server-pool-decom.go b/cmd/erasure-server-pool-decom.go index 554cd9cdf..6674f946d 100644 --- a/cmd/erasure-server-pool-decom.go +++ b/cmd/erasure-server-pool-decom.go @@ -701,7 +701,7 @@ func (z *erasureServerPools) decommissionPool(ctx context.Context, idx int, pool } versioned := vc != nil && vc.Versioned(object) objInfo := fi.ToObjectInfo(bucket, object, versioned) - action := evalActionFromLifecycle(ctx, *lc, lr, objInfo, false) + action := evalActionFromLifecycle(ctx, *lc, lr, objInfo) switch action { case lifecycle.DeleteVersionAction, lifecycle.DeleteAction: globalExpiryState.enqueueByDays(objInfo, false, action == lifecycle.DeleteVersionAction) diff --git a/cmd/erasure-server-pool.go b/cmd/erasure-server-pool.go index 88f2cc16a..738955fb8 100644 --- a/cmd/erasure-server-pool.go +++ b/cmd/erasure-server-pool.go @@ -1302,7 +1302,7 @@ func (z *erasureServerPools) ListObjects(ctx context.Context, bucket, prefix, ma objInfo, err := z.GetObjectInfo(ctx, bucket, prefix, ObjectOptions{NoLock: true}) if err == nil { if opts.Lifecycle != nil { - action := evalActionFromLifecycle(ctx, *opts.Lifecycle, opts.Retention, objInfo, false) + action := evalActionFromLifecycle(ctx, *opts.Lifecycle, opts.Retention, objInfo) switch action { case lifecycle.DeleteVersionAction, lifecycle.DeleteAction: fallthrough diff --git a/cmd/erasure-single-drive.go b/cmd/erasure-single-drive.go index af9fe6c6c..647b42acf 100644 --- a/cmd/erasure-single-drive.go +++ b/cmd/erasure-single-drive.go @@ -1465,7 +1465,7 @@ func (es *erasureSingle) DeleteObject(ctx context.Context, bucket, object string } if opts.Expiration.Expire { - action := evalActionFromLifecycle(ctx, *lc, rcfg, goi, false) + action := evalActionFromLifecycle(ctx, *lc, rcfg, goi) var isErr bool switch action { case lifecycle.NoneAction: @@ -2897,7 +2897,7 @@ func (es *erasureSingle) ListObjects(ctx context.Context, bucket, prefix, marker objInfo, err := es.GetObjectInfo(ctx, bucket, prefix, ObjectOptions{NoLock: true}) if err == nil { if opts.Lifecycle != nil { - action := evalActionFromLifecycle(ctx, *opts.Lifecycle, opts.Retention, objInfo, false) + action := evalActionFromLifecycle(ctx, *opts.Lifecycle, opts.Retention, objInfo) switch action { case lifecycle.DeleteVersionAction, lifecycle.DeleteAction: fallthrough diff --git a/cmd/metacache-server-pool.go b/cmd/metacache-server-pool.go index 8d0add523..b24c98560 100644 --- a/cmd/metacache-server-pool.go +++ b/cmd/metacache-server-pool.go @@ -625,7 +625,7 @@ func applyBucketActions(ctx context.Context, o listPathOptions, in <-chan metaCa objInfo := fi.ToObjectInfo(o.Bucket, obj.name, versioned) if o.Lifecycle != nil { - action := evalActionFromLifecycle(ctx, *o.Lifecycle, o.Retention, objInfo, false) + action := evalActionFromLifecycle(ctx, *o.Lifecycle, o.Retention, objInfo) switch action { case lifecycle.DeleteVersionAction, lifecycle.DeleteAction: globalExpiryState.enqueueByDays(objInfo, false, action == lifecycle.DeleteVersionAction) diff --git a/cmd/object-handlers.go b/cmd/object-handlers.go index 1b1626fec..be1011e0a 100644 --- a/cmd/object-handlers.go +++ b/cmd/object-handlers.go @@ -495,7 +495,7 @@ func (api objectAPIHandlers) getObjectHandler(ctx context.Context, objectAPI Obj // Automatically remove the object/version is an expiry lifecycle rule can be applied if lc, err := globalLifecycleSys.Get(bucket); err == nil { rcfg, _ := globalBucketObjectLockSys.Get(bucket) - action := evalActionFromLifecycle(ctx, *lc, rcfg, objInfo, false) + action := evalActionFromLifecycle(ctx, *lc, rcfg, objInfo) var success bool switch action { case lifecycle.DeleteVersionAction, lifecycle.DeleteAction: @@ -735,7 +735,7 @@ func (api objectAPIHandlers) headObjectHandler(ctx context.Context, objectAPI Ob // Automatically remove the object/version is an expiry lifecycle rule can be applied if lc, err := globalLifecycleSys.Get(bucket); err == nil { rcfg, _ := globalBucketObjectLockSys.Get(bucket) - action := evalActionFromLifecycle(ctx, *lc, rcfg, objInfo, false) + action := evalActionFromLifecycle(ctx, *lc, rcfg, objInfo) var success bool switch action { case lifecycle.DeleteVersionAction, lifecycle.DeleteAction: