mirror of
https://github.com/minio/minio.git
synced 2025-05-21 17:43:48 -04:00
fix: do not compute usage for not found lifecycle operations (#11288)
Currently we would proceed to apply incorrect lifecycle policies for non-existent objects, this PR handles them appropriately.
This commit is contained in:
parent
98f76008c7
commit
0dadfd1b3d
@ -863,8 +863,8 @@ func (i *crawlItem) applyActions(ctx context.Context, o ObjectLayer, meta action
|
|||||||
logger.LogIf(ctx, err)
|
logger.LogIf(ctx, err)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
case ObjectNotFound:
|
case ObjectNotFound, VersionNotFound:
|
||||||
// object not found return 0
|
// object not found or version not found return 0
|
||||||
return 0
|
return 0
|
||||||
default:
|
default:
|
||||||
// All other errors proceed.
|
// All other errors proceed.
|
||||||
@ -930,6 +930,9 @@ func (i *crawlItem) applyActions(ctx context.Context, o ObjectLayer, meta action
|
|||||||
opts.VersionID = obj.VersionID
|
opts.VersionID = obj.VersionID
|
||||||
opts.TransitionStatus = lifecycle.TransitionPending
|
opts.TransitionStatus = lifecycle.TransitionPending
|
||||||
if _, err = o.DeleteObject(ctx, obj.Bucket, obj.Name, opts); err != nil {
|
if _, err = o.DeleteObject(ctx, obj.Bucket, obj.Name, opts); err != nil {
|
||||||
|
if isErrObjectNotFound(err) || isErrVersionNotFound(err) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
// Assume it is still there.
|
// Assume it is still there.
|
||||||
logger.LogIf(ctx, err)
|
logger.LogIf(ctx, err)
|
||||||
return size
|
return size
|
||||||
@ -941,6 +944,9 @@ func (i *crawlItem) applyActions(ctx context.Context, o ObjectLayer, meta action
|
|||||||
|
|
||||||
if obj.TransitionStatus != "" {
|
if obj.TransitionStatus != "" {
|
||||||
if err := deleteTransitionedObject(ctx, o, i.bucket, i.objectPath(), lcOpts, action, false); err != nil {
|
if err := deleteTransitionedObject(ctx, o, i.bucket, i.objectPath(), lcOpts, action, false); err != nil {
|
||||||
|
if isErrObjectNotFound(err) || isErrVersionNotFound(err) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
logger.LogIf(ctx, err)
|
logger.LogIf(ctx, err)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
@ -950,6 +956,9 @@ func (i *crawlItem) applyActions(ctx context.Context, o ObjectLayer, meta action
|
|||||||
|
|
||||||
obj, err = o.DeleteObject(ctx, i.bucket, i.objectPath(), opts)
|
obj, err = o.DeleteObject(ctx, i.bucket, i.objectPath(), opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if isErrObjectNotFound(err) || isErrVersionNotFound(err) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
// Assume it is still there.
|
// Assume it is still there.
|
||||||
logger.LogIf(ctx, err)
|
logger.LogIf(ctx, err)
|
||||||
return size
|
return size
|
||||||
|
Loading…
x
Reference in New Issue
Block a user