From 9eb205cb62c6466887037397c5aa202b53d10c78 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Fri, 21 Feb 2025 08:00:46 -0800 Subject: [PATCH] Mirror should delete on delete marker creation + ILM (#5148) Fixes #5147 --- cmd/mirror-main.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/mirror-main.go b/cmd/mirror-main.go index 488f83b6..dfa1b687 100644 --- a/cmd/mirror-main.go +++ b/cmd/mirror-main.go @@ -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)) @@ -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