Data usage should account for transitioned objects (#11717)

This commit is contained in:
Krishnan Parthasarathi 2021-03-05 14:15:53 -08:00 committed by GitHub
parent 651487507a
commit bcf9825082
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -896,7 +896,11 @@ func (i *scannerItem) applyActions(ctx context.Context, o ObjectLayer, meta acti
} }
if applied { if applied {
return 0 switch action {
case lifecycle.TransitionAction, lifecycle.TransitionVersionAction:
default: // for all lifecycle actions that remove data
return 0
}
} }
return size return size
} }
@ -1039,7 +1043,7 @@ func applyExpiryRule(ctx context.Context, objLayer ObjectLayer, obj ObjectInfo,
return applyExpiryOnNonTransitionedObjects(ctx, objLayer, obj, applyOnVersion) 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) { func applyLifecycleAction(ctx context.Context, action lifecycle.Action, objLayer ObjectLayer, obj ObjectInfo) (success bool) {
switch action { switch action {
case lifecycle.DeleteVersionAction, lifecycle.DeleteAction: case lifecycle.DeleteVersionAction, lifecycle.DeleteAction:

View File

@ -44,7 +44,7 @@ type Action int
//go:generate stringer -type Action $GOFILE //go:generate stringer -type Action $GOFILE
const ( const (
// NoneAction means no action required after evaluting lifecycle rules // NoneAction means no action required after evaluating lifecycle rules
NoneAction Action = iota NoneAction Action = iota
// DeleteAction means the object needs to be removed after evaluating lifecycle rules // DeleteAction means the object needs to be removed after evaluating lifecycle rules
DeleteAction DeleteAction