Skip to content

Commit

Permalink
Mirror should delete on delete marker creation + ILM (#5148)
Browse files Browse the repository at this point in the history
Fixes #5147
  • Loading branch information
klauspost authored Feb 21, 2025
1 parent 0ba848a commit 9eb205c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmd/mirror-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,13 @@ func (m mirrorMessage) String() string {
if m.EventTime != "" {
msg = console.Colorize("Time", fmt.Sprintf("[%s] ", m.EventTime))
}
if m.EventType == notification.ObjectRemovedDelete {
switch m.EventType {
case notification.ObjectRemovedDelete:
return msg + "Removed " + console.Colorize("Removed", fmt.Sprintf("`%s`", m.Target))
case notification.ObjectRemovedDeleteMarkerCreated:
return msg + "Removed (Delete Marker)" + console.Colorize("Removed", fmt.Sprintf("`%s`", m.Target))
case notification.ILMDelMarkerExpirationDelete:
return msg + "Removed (ILM)" + console.Colorize("Removed", fmt.Sprintf("`%s`", m.Target))
}
if m.EventTime == "" {
return console.Colorize("Mirror", fmt.Sprintf("`%s` -> `%s`", m.Source, m.Target))
Expand Down Expand Up @@ -722,7 +727,9 @@ func (mj *mirrorJob) watchMirrorEvents(ctx context.Context, events []EventInfo)
mj.parallel.queueTask(func() URLs {
return mj.doMirrorWatch(ctx, targetPath, tgtSSE, mirrorURL, event)
}, mirrorURL.SourceContent.Size)
} else if event.Type == notification.ObjectRemovedDelete {
} else if event.Type == notification.ObjectRemovedDelete ||
event.Type == notification.ObjectRemovedDeleteMarkerCreated ||
event.Type == notification.ILMDelMarkerExpirationDelete {
if targetAlias != "" && strings.Contains(event.UserAgent, uaMirrorAppName+":"+targetAlias) {
// Ignore delete cascading delete events if cyclical.
continue
Expand Down

0 comments on commit 9eb205c

Please sign in to comment.