@@ -96,7 +96,7 @@ func (a *Agent) Delete(ctx context.Context, d *ctrl.DeleteBackupCmd, opid ctrl.O
9696 }
9797
9898 l .Info ("deleting backups older than %v" , t )
99- err = backup .DeleteBackupBefore (ctx , a .leadConn , t , bcpType , nodeInfo .Me )
99+ err = backup .DeleteBackupBefore (ctx , a .leadConn , t , bcpType , d . Profile , nodeInfo .Me )
100100 if err != nil {
101101 l .Error ("deleting: %v" , err )
102102 return
@@ -254,7 +254,7 @@ func (a *Agent) Cleanup(ctx context.Context, d *ctrl.CleanupCmd, opid ctrl.OPID,
254254 return
255255 }
256256
257- cfg , err := config .GetConfig (ctx , a .leadConn )
257+ cfg , err := config .GetProfiledConfig (ctx , a .leadConn , d . Profile )
258258 if err != nil {
259259 l .Error ("get config: %v" , err )
260260 }
@@ -267,7 +267,7 @@ func (a *Agent) Cleanup(ctx context.Context, d *ctrl.CleanupCmd, opid ctrl.OPID,
267267 eg := errgroup.Group {}
268268 eg .SetLimit (runtime .NumCPU ())
269269
270- cr , err := backup .MakeCleanupInfo (ctx , a .leadConn , d .OlderThan )
270+ cr , err := backup .MakeCleanupInfo (ctx , a .leadConn , d .OlderThan , d . Profile )
271271 if err != nil {
272272 l .Error ("make cleanup report: " + err .Error ())
273273 return
@@ -289,15 +289,20 @@ func (a *Agent) Cleanup(ctx context.Context, d *ctrl.CleanupCmd, opid ctrl.OPID,
289289 bcp := & cr .Backups [i ]
290290
291291 eg .Go (func () error {
292- err := backup .DeleteBackupFiles ( stg , bcp .Name )
293- return errors .Wrapf (err , "delete backup files %q" , bcp .Name )
292+ err := backup .DeleteBackup ( ctx , a . leadConn , bcp .Name , a . brief . Me )
293+ return errors .Wrapf (err , "delete backup %q" , bcp .Name )
294294 })
295295 }
296296 if err := eg .Wait (); err != nil {
297297 l .Error (err .Error ())
298298 }
299299
300- err = resync .Resync (ctx , a .leadConn , & cfg .Storage , a .brief .Me , false )
300+ if d .Profile == "" {
301+ err = resync .Resync (ctx , a .leadConn , & cfg .Storage , a .brief .Me , false )
302+ } else {
303+ err = resync .SyncBackupList (ctx , a .leadConn , & cfg .Storage , d .Profile , a .brief .Me )
304+ }
305+
301306 if err != nil {
302307 l .Error ("storage resync: " + err .Error ())
303308 }
@@ -306,7 +311,7 @@ func (a *Agent) Cleanup(ctx context.Context, d *ctrl.CleanupCmd, opid ctrl.OPID,
306311func (a * Agent ) deletePITRImpl (ctx context.Context , ts primitive.Timestamp ) error {
307312 l := log .LogEventFromContext (ctx )
308313
309- r , err := backup .MakeCleanupInfo (ctx , a .leadConn , ts )
314+ r , err := backup .MakeCleanupInfo (ctx , a .leadConn , ts , "" )
310315 if err != nil {
311316 return errors .Wrap (err , "get pitr chunks" )
312317 }
0 commit comments