Skip to content

restore: skip unchanged files and add --overwrite if-changed option#4838

Merged
MichaelEischer merged 9 commits intorestic:masterfrom
MichaelEischer:restore-skip-unchanged
Jun 13, 2024
Merged

restore: skip unchanged files and add --overwrite if-changed option#4838
MichaelEischer merged 9 commits intorestic:masterfrom
MichaelEischer:restore-skip-unchanged

Conversation

@MichaelEischer
Copy link
Copy Markdown
Member

@MichaelEischer MichaelEischer commented May 31, 2024

What does this PR change? What problem does it solve?

Based on #4837 .

On startup, the restore command now checks existing files to determine whether these have to be updated. By default, it verifies the full file content. To only checks whether the file size and modification time (mtime) match with those in the snapshot, use --overwrite if-changed. Files with matching file content will not be downloaded during the restore operation. Only their file metadata is updated.

Was the change previously discussed in an issue or on the forum?

See #4817
Fixes #407
Fixes #2662

Checklist

  • I have read the contribution guidelines.
  • I have enabled maintainer edits.
  • I have added tests for all code changes.
  • I have added documentation for relevant changes (in the manual).
  • There's a new file in changelog/unreleased/ that describes the changes for our users (see template).
  • I have run gofmt on the code in all commits.
  • All commit messages are formatted in the same style as the other commits in the repo.
  • I'm done! This pull request is ready for review.

@MichaelEischer MichaelEischer force-pushed the restore-skip-unchanged branch from 632cca9 to 20e30a9 Compare June 2, 2024 15:39
@MichaelEischer MichaelEischer changed the title restore: skip unchanged files and add --verify-existing option restore: skip unchanged files and add --overwrite if-changed option Jun 2, 2024
@MichaelEischer
Copy link
Copy Markdown
Member Author

Updated after discussion with @rawtaz. Instead of --verify-existing this PR now introduces --overwrite if-changed. Verifying the file content of files with matching size&mtime was only relevant for --overwrite always. Thus, add two separate overwrite behaviors.

@MichaelEischer MichaelEischer force-pushed the restore-skip-unchanged branch from 00c80d7 to 34d1cf5 Compare June 3, 2024 20:18
@MichaelEischer
Copy link
Copy Markdown
Member Author

MichaelEischer commented Jun 3, 2024

restore --verify now only checks files that are modified during restore. This requires tracking whether the file content or only it's metadata was updated. When using --overwrite=always then not modified files have already been verified while determining that a file is not modified. For --overwrite=if-changed the assumption is used that files with correct mtime&size are correct.

@MichaelEischer MichaelEischer force-pushed the restore-skip-unchanged branch 2 times, most recently from dc5e64a to 142d7d3 Compare June 3, 2024 20:31
@MichaelEischer MichaelEischer force-pushed the restore-skip-unchanged branch from e5345d5 to c684257 Compare June 12, 2024 20:55
@MichaelEischer MichaelEischer force-pushed the restore-skip-unchanged branch from c684257 to d890bff Compare June 13, 2024 19:17
Copy link
Copy Markdown
Member Author

@MichaelEischer MichaelEischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@MichaelEischer MichaelEischer merged commit 267cd62 into restic:master Jun 13, 2024
@MichaelEischer MichaelEischer deleted the restore-skip-unchanged branch June 13, 2024 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

Restore only changed files Make restore resumeable.

1 participant