restic/internal/restic
Michael Eischer d92957dd78 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.
2022-10-03 00:19:46 +02:00
..
testdata restic: Use stable sorting in snapshot policy 2022-08-07 14:10:40 +02:00
backend.go upgrade_repo_v2: Use atomic replace for supported backends 2022-05-09 22:31:30 +02:00
backend_find.go restic: ignore filenames which are not IDs when expanding a prefix 2022-09-27 20:30:40 +02:00
backend_find_test.go Improve error reporting from restic diff 2020-11-11 16:40:40 +01:00
blob.go crypto: move crypto buffer helpers 2022-07-17 13:42:23 +02:00
blob_set.go Move restic package to internal/restic 2017-07-24 17:43:32 +02:00
blob_test.go Move restic package to internal/restic 2017-07-24 17:43:32 +02:00
config.go repository: extract Load/StoreJSONUnpacked 2022-07-17 13:22:00 +02:00
config_test.go repository: extract Load/StoreJSONUnpacked 2022-07-17 13:22:00 +02:00
doc.go Move restic package to internal/restic 2017-07-24 17:43:32 +02:00
duration.go comment cleanup 2022-08-18 20:15:38 +02:00
duration_test.go forget: Fail test if duration parsing error is missing 2022-08-18 20:14:09 +02:00
file.go Simplify cache logic 2021-09-03 21:01:00 +02:00
file_test.go Use "pack file" instead of "data file" (#2885) 2020-08-16 11:16:38 +02:00
find.go repository: extract LoadTree/SaveTree 2022-07-17 13:11:28 +02:00
find_test.go repository: extract LoadTree/SaveTree 2022-07-17 13:11:28 +02:00
id.go internal/restic: Custom ID.MarshalJSON 2022-05-27 12:26:37 +02:00
id_int_test.go Move restic package to internal/restic 2017-07-24 17:43:32 +02:00
id_test.go restic: Make JSON unmarshal for ID more efficient 2019-04-13 13:38:39 +02:00
ids.go Move restic package to internal/restic 2017-07-24 17:43:32 +02:00
ids_test.go Move restic package to internal/restic 2017-07-24 17:43:32 +02:00
idset.go Move restic package to internal/restic 2017-07-24 17:43:32 +02:00
idset_test.go Move restic package to internal/restic 2017-07-24 17:43:32 +02:00
json.go repository: extract Load/StoreJSONUnpacked 2022-07-17 13:22:00 +02:00
lock.go lock: Implement strict lock expiry monitoring 2022-10-03 00:19:46 +02:00
lock_test.go Only display the message if there were locks to be removed 2022-09-24 19:02:24 +08:00
lock_unix.go add go:build headers everywhere 2022-03-28 22:23:47 +02:00
lock_windows.go Move restic package to internal/restic 2017-07-24 17:43:32 +02:00
mknod_unix.go add go:build headers everywhere 2022-03-28 22:23:47 +02:00
node.go use os.Remove if path already exists on symlink restore 2022-09-14 08:14:31 +02:00
node_aix.go add go:build headers everywhere 2022-03-28 22:23:47 +02:00
node_darwin.go Make restic.{lchown,mknod} regular functions 2021-05-27 22:51:40 +02:00
node_freebsd.go add go:build headers everywhere 2022-03-28 22:23:47 +02:00
node_linux.go Make restic.{lchown,mknod} regular functions 2021-05-27 22:51:40 +02:00
node_netbsd.go Make restic.{lchown,mknod} regular functions 2021-05-27 22:51:40 +02:00
node_openbsd.go Make restic.{lchown,mknod} regular functions 2021-05-27 22:51:40 +02:00
node_solaris.go [#issue 3127] Add xattr support for Solaris 2022-02-13 14:24:37 +05:30
node_test.go Fix test failures on Solaris 2022-01-25 18:05:56 -08:00
node_unix.go add go:build headers everywhere 2022-03-28 22:23:47 +02:00
node_unix_test.go add go:build headers everywhere 2022-03-28 22:23:47 +02:00
node_windows.go Make restic.{lchown,mknod} regular functions 2021-05-27 22:51:40 +02:00
node_xattr.go restic: Cleanup xattr error handling for Solaris 2022-08-23 21:25:15 +02:00
repository.go repository: optimize MasterIndex.Each 2022-09-24 12:21:59 +02:00
rewind_reader.go panic if hash returns an error 2021-08-04 22:17:46 +02:00
rewind_reader_test.go panic if hash returns an error 2021-08-04 22:17:46 +02:00
snapshot.go Fix quadratic time complexity of Snapshot.HasPaths 2022-08-30 04:38:17 +03:00
snapshot_find.go repository: extract Load/StoreJSONUnpacked 2022-07-17 13:22:00 +02:00
snapshot_find_test.go copy/find/ls/recover/stats: Memorize snapshot listing before index 2022-04-09 12:26:30 +02:00
snapshot_group.go Merge a few variable declaration and initializations 2020-09-05 10:05:34 +02:00
snapshot_policy.go restic: Use stable sorting in snapshot policy 2022-08-07 14:10:40 +02:00
snapshot_policy_test.go forget: Add --keep-within-hourly (and friends) 2021-07-24 16:14:43 +00:00
snapshot_test.go repository: extract Load/StoreJSONUnpacked 2022-07-17 13:22:00 +02:00
tag_list.go feat(tags): Create Flatten() method 2020-12-29 10:59:46 +01:00
tag_list_test.go feat(tags): Create Flatten() method 2020-12-29 10:59:46 +01:00
testing.go fuse: cleanup test 2022-08-05 23:46:46 +02:00
testing_test.go copy/find/ls/recover/stats: Memorize snapshot listing before index 2022-04-09 12:26:30 +02:00
tree.go archiver: Incrementally serialize tree nodes 2022-07-23 14:45:07 +02:00
tree_stream.go repository: extract LoadTree/SaveTree 2022-07-17 13:11:28 +02:00
tree_test.go archiver: Incrementally serialize tree nodes 2022-07-23 14:45:07 +02:00
zeroprefix.go restorer: move zeroPrefixLen to restic package 2022-09-24 21:39:39 +02:00
zeroprefix_test.go restorer: move zeroPrefixLen to restic package 2022-09-24 21:39:39 +02:00