restic/cmd/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 copy: test that trees with unstable json encoding are properly copied 2021-03-08 22:16:48 +01:00
.gitignore Moves files 2017-07-23 14:19:13 +02:00
cleanup.go Allow cleanup handlers to filter the exit code 2022-08-26 23:04:59 +02:00
cmd_backup.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_backup_test.go Add more error checks 2021-01-30 20:02:37 +01:00
cmd_cache.go restic cache should display the name of the cache without shortening it in the case of the restic check 2021-11-06 20:18:51 +01:00
cmd_cat.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_check.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_check_test.go [#issue 3490] Support for specifying file size in read-data-subset 2021-11-02 15:25:46 +05:30
cmd_copy.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_debug.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_diff.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_dump.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_dump_test.go dump: Add test for splitPath 2020-08-30 16:00:48 +02:00
cmd_find.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_forget.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_generate.go Add powershell completion 2022-09-11 00:44:12 +02:00
cmd_init.go Remove ctx from globalOptions 2022-10-03 00:19:46 +02:00
cmd_key.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_list.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_ls.go Remove ctx from globalOptions 2022-10-03 00:19:46 +02:00
cmd_ls_test.go Add file mode in symbolic notation to `ls --json` 2021-11-16 19:45:50 +02:00
cmd_migrate.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_mount.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_options.go Some `options` fixes 2020-12-23 23:26:04 +03:00
cmd_prune.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_rebuild_index.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_recover.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_restore.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_self_update.go Remove ctx from globalOptions 2022-10-03 00:19:46 +02:00
cmd_snapshots.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_snapshots_test.go Add more error checks 2021-01-30 20:02:37 +01:00
cmd_stats.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_tag.go Prepare for context bound to lock lifetime 2022-10-03 00:19:46 +02:00
cmd_unlock.go Remove ctx from globalOptions 2022-10-03 00:19:46 +02:00
cmd_version.go Add documentation on exit status codes to man pages 2020-02-12 23:09:26 +01:00
delete.go Remove ctx from globalOptions 2022-10-03 00:19:46 +02:00
doc.go Moves files 2017-07-23 14:19:13 +02:00
exclude.go Add more error checks 2021-01-30 20:02:37 +01:00
exclude_test.go Add tests 2020-11-28 17:00:31 +01:00
find.go tweak snapshot filter descriptions 2022-09-10 23:50:20 +02:00
flags_test.go Moves files 2017-07-23 14:19:13 +02:00
format.go Dead code removal 2020-08-04 08:38:57 +02:00
global.go Remove ctx from globalOptions 2022-10-03 00:19:46 +02:00
global_debug.go Allow cleanup handlers to filter the exit code 2022-08-26 23:04:59 +02:00
global_release.go add go:build headers everywhere 2022-03-28 22:23:47 +02:00
global_test.go Fix issues reported by staticcheck 2021-01-30 20:43:53 +01:00
integration_filter_pattern_test.go Test restore fails when using invalid patterns 2022-07-08 20:09:26 +02:00
integration_fuse_test.go Remove ctx from globalOptions 2022-10-03 00:19:46 +02:00
integration_helpers_test.go Remove ctx from globalOptions 2022-10-03 00:19:46 +02:00
integration_helpers_unix_test.go add go:build headers everywhere 2022-03-28 22:23:47 +02:00
integration_helpers_windows_test.go add go:build headers everywhere 2022-03-28 22:23:47 +02:00
integration_test.go Remove ctx from globalOptions 2022-10-03 00:19:46 +02:00
local_layout_test.go Support specifying multiple host flags for various commands 2020-02-26 22:17:59 +01:00
lock.go lock: Implement strict lock expiry monitoring 2022-10-03 00:19:46 +02:00
main.go all: Move away from pkg/errors, easy cases 2022-06-14 08:36:38 +02:00
progress.go cmd/restic: Remove trailing "..." from progress messages 2022-05-31 19:06:26 +02:00
secondary_repo.go Do not include the actual values of environment variables in help output 2022-08-26 20:39:54 +02:00
secondary_repo_test.go gofmt all files 2022-08-19 19:12:26 +02:00