Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsbackup can get "stuck" for days if there are a lot of old backups to prune #66

Closed
pm215 opened this issue Feb 16, 2020 · 2 comments
Closed
Assignees
Labels
Milestone

Comments

@pm215
Copy link

pm215 commented Feb 16, 2020

My backup strategy involves alternating between a couple of backup disks, which I periodically rotate offsite. This means that when I do a rotation, the "new" backup disk contains no backups from the past month or so, and then a lot of older staler backups from the period when it was last the currently-being-backed-up-to disk.

On the first evening after I swap backup disks, rsbackup will run a nightly backup. It then kicks off a prune-stale-backups process. Due to a combination of "I was a bit less frequent with my rotations than ideal" and "this disk is oddly slow at I/O", the prune-backups job has just taken 25 days to complete, deleting 356 old backups. During all this time no new backups were run, because the prune job had the lock on the backup system. When the pruning finally finished, all 25 nightly cronjobs ran one after another and I got 26 report emails all at once.

Some possibilities that might improve handling of this situation:

  • Have a config setting for "don't bother pruning more than N old backups at once"; this would spread the pruning process over multiple nights rather than trying to do it all in one go on day 1
  • More complicatedly, allow a backup job to interrupt or cancel an in-progress prune, rather than having to sit to wait for it to finish. Backups should take priority over housekeeping, unless there really isn't enough space on the disk for the backup at all.

(I am using rsbackup 3.1 because I'm still on Debian stretch on this machine.)

@ewxrjk ewxrjk added the bug label Feb 16, 2020
@ewxrjk
Copy link
Owner

ewxrjk commented Feb 16, 2020

You might want to look into a disk without a performance problem l-) But I do think that is a bug; pruning shouldn't block backups indefinitely.

My current thinking is to place a timeout on pruning, allowing a policy of e.g. "never spend more than 1 hour on pruning per invocation". Any outstanding rm subcommands would be killed when the timeout expires, and pruning would get to continue next time the cronjob ran.

@ewxrjk ewxrjk added this to the 7.0 milestone Feb 16, 2020
@ewxrjk ewxrjk self-assigned this Feb 16, 2020
ewxrjk added a commit that referenced this issue Mar 28, 2020
ewxrjk added a commit that referenced this issue Mar 28, 2020
ewxrjk added a commit that referenced this issue Mar 29, 2020
ewxrjk added a commit that referenced this issue Mar 29, 2020
@ewxrjk
Copy link
Owner

ewxrjk commented Mar 29, 2020

This is now implemented on the https://github.com/ewxrjk/rsbackup/tree/issue66 branch. @pm215 if you have time to test it and see if it meets your needs, let me know how you get on.

@ewxrjk ewxrjk closed this as completed May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants