From bcf9825082b3a3a50a7a940b980e07617630692c Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Fri, 5 Mar 2021 14:15:53 -0800 Subject: [PATCH] Data usage should account for transitioned objects (#11717) --- cmd/data-scanner.go | 8 ++++++-- pkg/bucket/lifecycle/lifecycle.go | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/data-scanner.go b/cmd/data-scanner.go index 66f03d29f..71f1042ee 100644 --- a/cmd/data-scanner.go +++ b/cmd/data-scanner.go @@ -896,7 +896,11 @@ func (i *scannerItem) applyActions(ctx context.Context, o ObjectLayer, meta acti } if applied { - return 0 + switch action { + case lifecycle.TransitionAction, lifecycle.TransitionVersionAction: + default: // for all lifecycle actions that remove data + return 0 + } } return size } @@ -1039,7 +1043,7 @@ func applyExpiryRule(ctx context.Context, objLayer ObjectLayer, obj ObjectInfo, return applyExpiryOnNonTransitionedObjects(ctx, objLayer, obj, applyOnVersion) } -// Perform actions (removal of transitioning of objects), return true the action is successfully performed +// Perform actions (removal or transitioning of objects), return true the action is successfully performed func applyLifecycleAction(ctx context.Context, action lifecycle.Action, objLayer ObjectLayer, obj ObjectInfo) (success bool) { switch action { case lifecycle.DeleteVersionAction, lifecycle.DeleteAction: diff --git a/pkg/bucket/lifecycle/lifecycle.go b/pkg/bucket/lifecycle/lifecycle.go index 2b7a0547d..874c9c59a 100644 --- a/pkg/bucket/lifecycle/lifecycle.go +++ b/pkg/bucket/lifecycle/lifecycle.go @@ -44,7 +44,7 @@ type Action int //go:generate stringer -type Action $GOFILE const ( - // NoneAction means no action required after evaluting lifecycle rules + // NoneAction means no action required after evaluating lifecycle rules NoneAction Action = iota // DeleteAction means the object needs to be removed after evaluating lifecycle rules DeleteAction