mirror of
https://github.com/minio/minio.git
synced 2025-04-17 01:10:29 -04:00
remove unecessary metadata structs in applyTransitionAction() (#13059)
This commit is contained in:
parent
da3f4bd452
commit
bbf3576f70
@ -329,6 +329,7 @@ func transitionObject(ctx context.Context, objectAPI ObjectLayer, oi ObjectInfo)
|
|||||||
},
|
},
|
||||||
VersionID: oi.VersionID,
|
VersionID: oi.VersionID,
|
||||||
Versioned: globalBucketVersioningSys.Enabled(oi.Bucket),
|
Versioned: globalBucketVersioningSys.Enabled(oi.Bucket),
|
||||||
|
VersionSuspended: globalBucketVersioningSys.Suspended(oi.Bucket),
|
||||||
MTime: oi.ModTime,
|
MTime: oi.ModTime,
|
||||||
}
|
}
|
||||||
return objectAPI.TransitionObject(ctx, oi.Bucket, oi.Name, opts)
|
return objectAPI.TransitionObject(ctx, oi.Bucket, oi.Name, opts)
|
||||||
|
@ -996,9 +996,9 @@ func (i *scannerItem) applyTierObjSweep(ctx context.Context, o ObjectLayer, meta
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove this free version
|
// Remove this free version
|
||||||
opts := ObjectOptions{}
|
_, err = o.DeleteObject(ctx, meta.oi.Bucket, meta.oi.Name, ObjectOptions{
|
||||||
opts.VersionID = meta.oi.VersionID
|
VersionID: meta.oi.VersionID,
|
||||||
_, err = o.DeleteObject(ctx, meta.oi.Bucket, meta.oi.Name, opts)
|
})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
auditLogLifecycle(ctx, meta.oi, ILMFreeVersionDelete)
|
auditLogLifecycle(ctx, meta.oi, ILMFreeVersionDelete)
|
||||||
}
|
}
|
||||||
@ -1063,18 +1063,10 @@ func evalActionFromLifecycle(ctx context.Context, lc lifecycle.Lifecycle, obj Ob
|
|||||||
return action
|
return action
|
||||||
}
|
}
|
||||||
|
|
||||||
func applyTransitionAction(ctx context.Context, action lifecycle.Action, objLayer ObjectLayer, obj ObjectInfo) bool {
|
func applyTransitionRule(ctx context.Context, action lifecycle.Action, objLayer ObjectLayer, obj ObjectInfo) bool {
|
||||||
srcOpts := ObjectOptions{}
|
|
||||||
if obj.TransitionedObject.Status == "" {
|
|
||||||
srcOpts.Versioned = globalBucketVersioningSys.Enabled(obj.Bucket)
|
|
||||||
srcOpts.VersionID = obj.VersionID
|
|
||||||
// mark transition as pending
|
|
||||||
obj.UserDefined[ReservedMetadataPrefixLower+TransitionStatus] = lifecycle.TransitionPending
|
|
||||||
obj.metadataOnly = true // Perform only metadata updates.
|
|
||||||
if obj.DeleteMarker {
|
if obj.DeleteMarker {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
|
||||||
globalTransitionState.queueTransitionTask(obj)
|
globalTransitionState.queueTransitionTask(obj)
|
||||||
return true
|
return true
|
||||||
|
|
||||||
@ -1151,7 +1143,7 @@ func applyLifecycleAction(ctx context.Context, action lifecycle.Action, objLayer
|
|||||||
case lifecycle.DeleteRestoredAction, lifecycle.DeleteRestoredVersionAction:
|
case lifecycle.DeleteRestoredAction, lifecycle.DeleteRestoredVersionAction:
|
||||||
success = applyExpiryRule(ctx, objLayer, obj, true, action == lifecycle.DeleteRestoredVersionAction)
|
success = applyExpiryRule(ctx, objLayer, obj, true, action == lifecycle.DeleteRestoredVersionAction)
|
||||||
case lifecycle.TransitionAction, lifecycle.TransitionVersionAction:
|
case lifecycle.TransitionAction, lifecycle.TransitionVersionAction:
|
||||||
success = applyTransitionAction(ctx, action, objLayer, obj)
|
success = applyTransitionRule(ctx, action, objLayer, obj)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1476,7 +1476,6 @@ func (er erasureObjects) TransitionObject(ctx context.Context, bucket, object st
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer NSUpdated(bucket, object)
|
|
||||||
|
|
||||||
// Acquire write lock before starting to transition the object.
|
// Acquire write lock before starting to transition the object.
|
||||||
lk := er.NewNSLock(bucket, object)
|
lk := er.NewNSLock(bucket, object)
|
||||||
@ -1506,6 +1505,8 @@ func (er erasureObjects) TransitionObject(ctx context.Context, bucket, object st
|
|||||||
if fi.TransitionStatus == lifecycle.TransitionComplete {
|
if fi.TransitionStatus == lifecycle.TransitionComplete {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
defer NSUpdated(bucket, object)
|
||||||
|
|
||||||
if fi.XLV1 {
|
if fi.XLV1 {
|
||||||
if _, err = er.HealObject(ctx, bucket, object, "", madmin.HealOpts{NoLock: true}); err != nil {
|
if _, err = er.HealObject(ctx, bucket, object, "", madmin.HealOpts{NoLock: true}); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -1548,6 +1549,7 @@ func (er erasureObjects) TransitionObject(ctx context.Context, bucket, object st
|
|||||||
if err = er.deleteObjectVersion(ctx, bucket, object, writeQuorum, fi, false); err != nil {
|
if err = er.deleteObjectVersion(ctx, bucket, object, writeQuorum, fi, false); err != nil {
|
||||||
eventName = event.ObjectTransitionFailed
|
eventName = event.ObjectTransitionFailed
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, disk := range storageDisks {
|
for _, disk := range storageDisks {
|
||||||
if disk != nil && disk.IsOnline() {
|
if disk != nil && disk.IsOnline() {
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user