mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
ilm: Send delete marker creation event when appropriate (#10696)
Before this commit, the crawler ILM will always send object delete event notification though this is wrong.
This commit is contained in:
parent
0b53e30ecb
commit
284a2b9021
@ -487,19 +487,21 @@ func (api objectAPIHandlers) DeleteMultipleObjectsHandler(w http.ResponseWriter,
|
|||||||
|
|
||||||
// Notify deleted event for objects.
|
// Notify deleted event for objects.
|
||||||
for _, dobj := range deletedObjects {
|
for _, dobj := range deletedObjects {
|
||||||
|
eventName := event.ObjectRemovedDelete
|
||||||
|
|
||||||
objInfo := ObjectInfo{
|
objInfo := ObjectInfo{
|
||||||
Name: dobj.ObjectName,
|
Name: dobj.ObjectName,
|
||||||
VersionID: dobj.VersionID,
|
VersionID: dobj.VersionID,
|
||||||
}
|
}
|
||||||
|
|
||||||
if dobj.DeleteMarker {
|
if dobj.DeleteMarker {
|
||||||
objInfo = ObjectInfo{
|
objInfo.DeleteMarker = dobj.DeleteMarker
|
||||||
Name: dobj.ObjectName,
|
objInfo.VersionID = dobj.DeleteMarkerVersionID
|
||||||
DeleteMarker: dobj.DeleteMarker,
|
eventName = event.ObjectRemovedDeleteMarkerCreated
|
||||||
VersionID: dobj.DeleteMarkerVersionID,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sendEvent(eventArgs{
|
sendEvent(eventArgs{
|
||||||
EventName: event.ObjectRemovedDelete,
|
EventName: eventName,
|
||||||
BucketName: bucket,
|
BucketName: bucket,
|
||||||
Object: objInfo,
|
Object: objInfo,
|
||||||
ReqParams: extractReqParams(r),
|
ReqParams: extractReqParams(r),
|
||||||
|
@ -747,9 +747,14 @@ func (i *crawlItem) applyActions(ctx context.Context, o ObjectLayer, meta action
|
|||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eventName := event.ObjectRemovedDelete
|
||||||
|
if obj.DeleteMarker {
|
||||||
|
eventName = event.ObjectRemovedDeleteMarkerCreated
|
||||||
|
}
|
||||||
|
|
||||||
// Notify object deleted event.
|
// Notify object deleted event.
|
||||||
sendEvent(eventArgs{
|
sendEvent(eventArgs{
|
||||||
EventName: event.ObjectRemovedDelete,
|
EventName: eventName,
|
||||||
BucketName: i.bucket,
|
BucketName: i.bucket,
|
||||||
Object: obj,
|
Object: obj,
|
||||||
Host: "Internal: [ILM-EXPIRY]",
|
Host: "Internal: [ILM-EXPIRY]",
|
||||||
|
@ -291,30 +291,20 @@ func deleteObject(ctx context.Context, obj ObjectLayer, cache CacheObjectLayer,
|
|||||||
// Proceed to delete the object.
|
// Proceed to delete the object.
|
||||||
objInfo, err = deleteObject(ctx, bucket, object, opts)
|
objInfo, err = deleteObject(ctx, bucket, object, opts)
|
||||||
if objInfo.Name != "" {
|
if objInfo.Name != "" {
|
||||||
// Requesting only a delete marker which was successfully attempted.
|
eventName := event.ObjectRemovedDelete
|
||||||
if objInfo.DeleteMarker {
|
if objInfo.DeleteMarker {
|
||||||
// Notify object deleted marker event.
|
eventName = event.ObjectRemovedDeleteMarkerCreated
|
||||||
sendEvent(eventArgs{
|
|
||||||
EventName: event.ObjectRemovedDeleteMarkerCreated,
|
|
||||||
BucketName: bucket,
|
|
||||||
Object: objInfo,
|
|
||||||
ReqParams: extractReqParams(r),
|
|
||||||
RespElements: extractRespElements(w),
|
|
||||||
UserAgent: r.UserAgent(),
|
|
||||||
Host: handlers.GetSourceIP(r),
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
// Notify object deleted event.
|
|
||||||
sendEvent(eventArgs{
|
|
||||||
EventName: event.ObjectRemovedDelete,
|
|
||||||
BucketName: bucket,
|
|
||||||
Object: objInfo,
|
|
||||||
ReqParams: extractReqParams(r),
|
|
||||||
RespElements: extractRespElements(w),
|
|
||||||
UserAgent: r.UserAgent(),
|
|
||||||
Host: handlers.GetSourceIP(r),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
// Notify object deleted marker event.
|
||||||
|
sendEvent(eventArgs{
|
||||||
|
EventName: eventName,
|
||||||
|
BucketName: bucket,
|
||||||
|
Object: objInfo,
|
||||||
|
ReqParams: extractReqParams(r),
|
||||||
|
RespElements: extractRespElements(w),
|
||||||
|
UserAgent: r.UserAgent(),
|
||||||
|
Host: handlers.GetSourceIP(r),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
return objInfo, err
|
return objInfo, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user