-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Exclude specific backends from pruning #262
Conversation
It's fine if you wanna wait for #261, but the way tests are written won't change with that PR. It will just be easier / more robust to run them, especially locally. It could well be that it still takes me a week or two to get that into a state that I'd wanna merge it in. Anyways, whatever you prefer, just wanted to mention it. |
Ok, good to know. Implementing #93 with pruning policies first could fix this issue, as it should enable us to prune all existing backups (e.g. when keep-n=1). |
I'm surprised I didn't think of it when I set all of this up, but right now I'd implement tests for pruning like this:
Or am I missing something here.
Question is what does implementing #93 even look like? Story time: v2 of this tool is a rewrite in Go as I did not manage to properly implement pruning in the v1 bash version, instead the tool would wipe all backups (#18). Ugh. Ever since then, I tend to believe this tool is better off with a pruning strategy that is very simple and hard to get wrong. All I am trying to say is: if we were to enhance the current mechanism, I'd like to discuss and understand it in detail. Also, I don't think the current mechanism is a real show stopper. |
Sounds like a good solution to me
Since implementing #93 (in part) was mostly to fix the pruning test issue, I absolutely agree. Let's only do this when we know how and if we want to do that. |
It finally works. Azure has the issue, that it ignores the modifiedTime metadata of the file and just uses the upload date instead... so going back in time, upload another 'old' file, going forward to the present (set OS date) and then running backup again works. Will do the other tests (where applicable) tomorrow. Really looking forward to your enhanced solution for running the tests, so I can just |
Also add -q or --quiet-pull to all tests.
All test cases for storage backends include a pruning test case now. Manipulating time was a little different for each one, but nothing magical in hindsight. Also added two test cases in |
|
||
// skipPrune returns true if the given backend name is contained in the | ||
// list of skipped backends. | ||
func skipPrune(name string, skippedBackends []string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if the name should be as specific, as the logic in the function really is very generic. Maybe this could be containedEqualFold(item string, list []string)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought about this too, also had this briefly inside util.go
as it is very generic and could be used by any module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilliant work once again, thanks!
Fixes #207
Content
New env variable:
BACKUP_SKIP_BACKENDS_FROM_PRUNE
All mentioned storage backend names will be excluded from pruning.
Notes
Tests will be added after #261 is available.
Todo