restic/cmd/restic
Gilbert Gilb's 536ebefff4
feat(backends/s3): add warmup support before repacks and restores (#5173)
* feat(backends/s3): add warmup support before repacks and restores

This commit introduces basic support for transitioning pack files stored
in cold storage to hot storage on S3 and S3-compatible providers.

To prevent unexpected behavior for existing users, the feature is gated
behind new flags:

- `s3.enable-restore`: opt-in flag (defaults to false)
- `s3.restore-days`: number of days for the restored objects to remain
  in hot storage (defaults to `7`)
- `s3.restore-timeout`: maximum time to wait for a single restoration
  (default to `1 day`)
- `s3.restore-tier`: retrieval tier at which the restore will be
  processed. (default to `Standard`)

As restoration times can be lengthy, this implementation preemptively
restores selected packs to prevent incessant restore-delays during
downloads. This is slightly sub-optimal as we could process packs
out-of-order (as soon as they're transitioned), but this would really
add too much complexity for a marginal gain in speed.

To maintain simplicity and prevent resources exhautions with lots of
packs, no new concurrency mechanisms or goroutines were added. This just
hooks gracefully into the existing routines.

**Limitations:**

- Tests against the backend were not written due to the lack of cold
  storage class support in MinIO. Testing was done manually on
  Scaleway's S3-compatible object storage. If necessary, we could
  explore testing with LocalStack or mocks, though this requires further
  discussion.
- Currently, this feature only warms up before restores and repacks
  (prune/copy), as those are the two main use-cases I came across.
  Support for other commands may be added in future iterations, as long
  as affected packs can be calculated in advance.
- The feature is gated behind a new alpha `s3-restore` feature flag to
  make it explicit that the feature is still wet behind the ears.
- There is no explicit user notification for ongoing pack restorations.
  While I think it is not necessary because of the opt-in flag, showing
  some notice may improve usability (but would probably require major
  refactoring in the progress bar which I didn't want to start). Another
  possibility would be to add a flag to send restores requests and fail
  early.

See https://github.com/restic/restic/issues/3202

* ui: warn user when files are warming up from cold storage

* refactor: remove the PacksWarmer struct

It's easier to handle multiple handles in the backend directly, and it
may open the door to reducing the number of requests made to the backend
in the future.
2025-02-01 18:26:27 +00:00
..
testdata index: deprecate legacy index format 2024-03-09 18:21:14 +01:00
.gitignore Moves files 2017-07-23 14:19:13 +02:00
cleanup.go remove global shutdown hook 2024-04-22 22:27:19 +02:00
cmd_backup.go repository: expose cache via method 2025-01-13 22:40:18 +01:00
cmd_backup_integration_test.go fs: inline ExtendedStat 2024-11-30 16:19:16 +01:00
cmd_backup_test.go improve fprintf related error handling 2024-11-01 17:07:43 +01:00
cmd_cache.go backend: consistently use os package for filesystem access 2024-08-31 18:20:40 +02:00
cmd_cat.go group commands and make features/options visible 2024-08-30 12:45:20 +02:00
cmd_cat_test.go cat: extract parameter validation and add a test 2023-08-13 19:17:46 +02:00
cmd_check.go backend: consistently use os package for filesystem access 2024-08-31 18:20:40 +02:00
cmd_check_integration_test.go check/migrate: convert to use termstatus to prevent mangled output 2024-05-30 15:09:27 +02:00
cmd_check_test.go check: fix cachedir creation when using default location 2024-06-30 12:04:57 +02:00
cmd_copy.go feat(backends/s3): add warmup support before repacks and restores (#5173) 2025-02-01 18:26:27 +00:00
cmd_copy_integration_test.go backup: run test with absolute path 2024-10-31 22:07:15 +01:00
cmd_debug.go index: remove support for legacy index format 2024-08-31 17:12:43 +02:00
cmd_diff.go add proper constants for node type 2024-08-31 18:20:01 +02:00
cmd_diff_integration_test.go always access stdout/stderr via globalOptions 2023-05-26 19:38:44 +02:00
cmd_dump.go add proper constants for node type 2024-08-31 18:20:01 +02:00
cmd_dump_test.go dump: Add test for splitPath 2020-08-30 16:00:48 +02:00
cmd_features.go group commands and make features/options visible 2024-08-30 12:45:20 +02:00
cmd_find.go Issue 4433: Ability to define sort order for output of find command (#5184) 2025-01-29 20:44:16 +00:00
cmd_find_integration_test.go Issue 4433: Ability to define sort order for output of find command (#5184) 2025-01-29 20:44:16 +00:00
cmd_forget.go repository: restrict SaveUnpacked and RemoveUnpacked 2025-01-13 22:39:57 +01:00
cmd_forget_integration_test.go Fix typos 2024-07-03 20:02:06 +02:00
cmd_forget_test.go forget: simplify test 2023-07-28 19:21:40 +02:00
cmd_generate.go generate: allow passing - for stdout output 2024-09-16 10:54:00 +03:00
cmd_generate_integration_test.go generate: allow passing - for stdout output 2024-09-16 10:54:00 +03:00
cmd_init.go group commands and make features/options visible 2024-08-30 12:45:20 +02:00
cmd_init_integration_test.go Add temporary files repositories in integration tests 2024-08-31 16:50:06 +02:00
cmd_key.go Add missing DisableAutoGenTag flag for commands 2024-08-30 12:45:20 +02:00
cmd_key_add.go main: return an exit code (12) for "bad password" errors 2024-08-30 12:39:22 +02:00
cmd_key_integration_test.go Add --insecure-no-password option 2024-05-24 22:38:20 +02:00
cmd_key_list.go main: return an exit code (12) for "bad password" errors 2024-08-30 12:39:22 +02:00
cmd_key_passwd.go main: return an exit code (12) for "bad password" errors 2024-08-30 12:39:22 +02:00
cmd_key_remove.go main: return an exit code (12) for "bad password" errors 2024-08-30 12:39:22 +02:00
cmd_list.go list: validate subcommand 2024-10-18 21:47:59 +02:00
cmd_list_integration_test.go Remove all usages of the global command-specific options 2024-01-23 19:21:39 +01:00
cmd_ls.go ls: proper error handling if output is not possible 2024-11-01 17:07:43 +01:00
cmd_ls_integration_test.go ls: fix handling of toplevel directories in ncdu output 2024-07-12 21:49:35 +02:00
cmd_ls_test.go ls: proper error handling if output is not possible 2024-11-01 17:07:43 +01:00
cmd_migrate.go group commands and make features/options visible 2024-08-30 12:45:20 +02:00
cmd_mount.go mount: use os instead of fs package 2024-08-31 18:20:41 +02:00
cmd_mount_integration_test.go mount: enable debug log for TestMountSameTimestamps 2024-08-03 22:17:07 +02:00
cmd_options.go group commands and make features/options visible 2024-08-30 12:45:20 +02:00
cmd_prune.go repository: expose cache via method 2025-01-13 22:40:18 +01:00
cmd_prune_integration_test.go use OrderedListOnceBackend where possible 2024-08-31 16:50:06 +02:00
cmd_recover.go repository: restrict SaveUnpacked and RemoveUnpacked 2025-01-13 22:39:57 +01:00
cmd_repair.go Add missing DisableAutoGenTag flag for commands 2024-08-30 12:45:20 +02:00
cmd_repair_index.go main: return an exit code (12) for "bad password" errors 2024-08-30 12:39:22 +02:00
cmd_repair_index_integration_test.go index: move to repository package 2024-05-25 13:13:03 +02:00
cmd_repair_packs.go main: return an exit code (12) for "bad password" errors 2024-08-30 12:39:22 +02:00
cmd_repair_snapshots.go repair snapshots: remove irregular files 2024-10-18 21:57:52 +02:00
cmd_repair_snapshots_integration_test.go forget: test --unsafe-allow-remove-all and --keep-tags safety check 2024-05-24 20:45:33 +02:00
cmd_restore.go feat(backends/s3): add warmup support before repacks and restores (#5173) 2025-02-01 18:26:27 +00:00
cmd_restore_integration_test.go backup: run test with absolute path 2024-10-31 22:07:15 +01:00
cmd_rewrite.go repository: restrict SaveUnpacked and RemoveUnpacked 2025-01-13 22:39:57 +01:00
cmd_rewrite_integration_test.go move include/exclude options to filter package 2024-08-31 18:04:07 +02:00
cmd_self_update.go main: return an exit code (12) for "bad password" errors 2024-08-30 12:39:22 +02:00
cmd_snapshots.go improve fprintf related error handling 2024-11-01 17:07:43 +01:00
cmd_snapshots_integration_test.go read JSON/Quiet flag from the passed in globalOptions 2023-05-26 19:38:44 +02:00
cmd_snapshots_test.go Add more error checks 2021-01-30 20:02:37 +01:00
cmd_stats.go add proper constants for node type 2024-08-31 18:20:01 +02:00
cmd_stats_test.go stats: Add debug mode to collect repository statistics 2023-07-08 23:04:47 +02:00
cmd_tag.go tag: output the original ID and new snapshotID (#5144) 2025-01-14 18:57:47 +01:00
cmd_tag_integration_test.go tag: output the original ID and new snapshotID (#5144) 2025-01-14 18:57:47 +01:00
cmd_unlock.go repository: restrict SaveUnpacked and RemoveUnpacked 2025-01-13 22:39:57 +01:00
cmd_version.go version: add message_type in --json mode 2024-08-11 12:51:15 -04:00
doc.go Moves files 2017-07-23 14:19:13 +02:00
exclude.go repository: expose cache via method 2025-01-13 22:40:18 +01:00
find.go clarify that all paths specified using --path option must match 2024-06-30 20:32:36 +02:00
find_test.go complete RESITC_HOST environment handling & test 2024-04-24 21:52:39 +02:00
flags_test.go Replace most usages of ioutil with the underlying function 2022-12-02 19:36:43 +01:00
format.go add proper constants for node type 2024-08-31 18:20:01 +02:00
format_test.go add proper constants for node type 2024-08-31 18:20:01 +02:00
global.go Merge branch 'patch-release' 2024-11-09 11:43:01 +01:00
global_debug.go debug: replace cleanup handler usage in profiling setup 2024-04-22 22:27:19 +02:00
global_release.go debug: replace cleanup handler usage in profiling setup 2024-04-22 22:27:19 +02:00
global_test.go Merge pull request #4845 from greatroar/errors 2024-06-07 17:07:07 +00:00
integration_filter_pattern_test.go move include/exclude options to filter package 2024-08-31 18:04:07 +02:00
integration_helpers_test.go repository: restrict SaveUnpacked and RemoveUnpacked 2025-01-13 22:39:57 +01:00
integration_helpers_unix_test.go improve fprintf related error handling 2024-11-01 17:07:43 +01:00
integration_helpers_windows_test.go Replace usages of ioutil.ReadDir 2022-12-02 19:54:27 +01:00
integration_test.go Merge pull request #5112 from MichaelEischer/fix-vss-root-volume 2024-11-03 21:30:39 +01:00
lock.go Fix typos 2024-07-03 20:02:06 +02:00
main.go improve fprintf related error handling 2024-11-01 17:07:43 +01:00
progress.go chore: fix some function names 2024-09-01 00:54:39 +08:00
secondary_repo.go Improve description for no password on secondary repo 2024-08-30 12:45:20 +02:00
secondary_repo_test.go use standalone shutdown hook for readPasswordTerminal 2024-04-22 22:27:19 +02:00
termstatus.go ui, termstatus: Move WrapStdio 2024-05-21 11:25:16 +02:00