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

repo gets locked too often preventing simultaneous backups #244

Open
AlexZorzi opened this issue Apr 23, 2024 · 3 comments
Open

repo gets locked too often preventing simultaneous backups #244

AlexZorzi opened this issue Apr 23, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@AlexZorzi
Copy link

AlexZorzi commented Apr 23, 2024

Describe the bug
Unlike restic cli, backrest default behavior is to lock the repo, might be due to restic forget(?)

To Reproduce
Steps to reproduce the behavior:

  1. Start a backup on one Host (in this example my repo is a http restic-server)
  2. On the second host start another backup
  3. Second host finds a lock on the repo and isn't able to finish the backup

This is fine on small setups since by spanning the cronjobs far enough it leaves time for restic to finish backup and remove the lock. With a high amount of hosts or with frequent backups this ends up failing all the backups.

I guess the issue is that backrest is running restic forget for every backup. And restic forget has to lock the repo to be safe, so a solution could be to move restic forget only in a maintenance cronjob and not at each backup.

Expected behavior
For backups to run on multiple hosts at the same time and only lock the repo when running a maintenance job

Platform Info

  • OS and Architecture Linux
  • Backrest Version 0.16.0
@AlexZorzi AlexZorzi added the bug Something isn't working label Apr 23, 2024
@AlexZorzi
Copy link
Author

The Auto Unlock option for the repo is not a solution since this would make the restic forget command unsafe.
My solution is to lower the amount of times restic forget runs all together, while remaining safe

@watn3y
Copy link

watn3y commented Apr 25, 2024

It seems like currently we run restic forget after every backup and restic prune if the last run is older than Max Frequency Days

One possible solution would be to run forget and prune on a set schedule instead of after every backup.

For example:

Of course, one option is to just use a separate repo for each host. But deduplication is nice and by using a single repo we get to take advantage of it :)

Also, if #221 ever gets implemented, the current design would potentially prevent backups (on the same host) from running in parallel.

@AlexZorzi AlexZorzi changed the title Backrest simultaneous hosts backups repo gets locked too often perverting Apr 25, 2024
@AlexZorzi AlexZorzi changed the title repo gets locked too often perverting repo gets locked too often preventing simultaneous backups Apr 25, 2024
@garethgeorge
Copy link
Owner

garethgeorge commented Apr 25, 2024

This is tricky, agreed re: more flexible scheduling policies being the long term fix -- this is likely a little ways out. I think for now multiple repos (or careful selection of backup schedules) is the correct way to handle this.

I think if using Backrest to backup a large number of systems the right approach for now would be to use retention policy = none and to create a cron script on a single host that does your forget and prune operations.

But this is a good bug report -- it's definitely a goal that this should just work entirely within Backrest (e.g. without requiring external scripts).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants