-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Strict repository lock handling #3569
Merged
Merged
Commits on Oct 2, 2022
-
Remove unnecessary context.WithCancel calls
The gopts.ctx is cancelled when the main() method of restic exits.
Configuration menu - View commit details
-
Copy full SHA for d0668b6 - Browse repository at this point
Copy the full SHA d0668b6View commit details -
Configuration menu - View commit details
-
Copy full SHA for ab819b2 - Browse repository at this point
Copy the full SHA ab819b2View commit details -
Previously the global context was either accessed via gopts.ctx, stored in a local variable and then used within that function or sometimes both. This makes it very hard to follow which ctx or a wrapped version of it reaches which method. Thus just drop the context from the globalOptions struct and pass it explicitly to every command line handler method.
Configuration menu - View commit details
-
Copy full SHA for 985722b - Browse repository at this point
Copy the full SHA 985722bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 928914f - Browse repository at this point
Copy the full SHA 928914fView commit details -
lock: Implement strict lock expiry monitoring
Restic continued e.g. a backup task even when it failed to renew the lock or failed to do so in time. For example if a backup client enters standby during the backup this can allow other operations like `prune` to run in the meantime (after calling `unlock`). After leaving standby the backup client will continue its backup and upload indexes which refer pack files that were removed in the meantime. This commit introduces a goroutine explicitly monitoring for locks that are not refreshed in time. To simplify the implementation there's now a separate goroutine to refresh the lock and monitor for timeouts for each lock. The monitoring goroutine would now cause the backup to fail as the client has lost it's lock in the meantime. The lock refresh goroutines are bound to the context used to lock the repository initially. The context returned by `lockRepo` is also cancelled when any of the goroutines exits. This ensures that the context is cancelled whenever for any reason the lock is no longer refreshed.
Configuration menu - View commit details
-
Copy full SHA for d92957d - Browse repository at this point
Copy the full SHA d92957dView commit details -
Configuration menu - View commit details
-
Copy full SHA for c3538b0 - Browse repository at this point
Copy the full SHA c3538b0View commit details -
The tests check that the wrapped context is properly canceled whenever the repository is unlock or when the lock refresh fails.
Configuration menu - View commit details
-
Copy full SHA for 9959190 - Browse repository at this point
Copy the full SHA 9959190View commit details -
Configuration menu - View commit details
-
Copy full SHA for aeed420 - Browse repository at this point
Copy the full SHA aeed420View commit details -
lock: Do not ignore invalid lock files
While searching for lock file from concurrently running restic instances, restic ignored unreadable lock files. These can either be in fact invalid or just be temporarily unreadable. As it is not really possible to differentiate between both cases, just err on the side of caution and consider the repository as already locked. The code retries searching for other locks up to three times to smooth out temporarily unreadable lock files.
Configuration menu - View commit details
-
Copy full SHA for 401e432 - Browse repository at this point
Copy the full SHA 401e432View commit details -
lock: fix timer expiry monitoring during standby
Monotonic timers are paused during standby. Thus these timers won't fire after waking up. Fall back to periodic polling to detect too large clock jumps. See golang/go#35012 for a discussion of go timers during standby.
Configuration menu - View commit details
-
Copy full SHA for 4912679 - Browse repository at this point
Copy the full SHA 4912679View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6d2d297 - Browse repository at this point
Copy the full SHA 6d2d297View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.