-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add --ignore-ctime flag to backup and document change detection #2823
Conversation
97d53b4
to
1504356
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Only few suggestions due to my personal preferences. May as well be ignored 😄
I especially like updated documentation that clarifies things to users!
06d0f1f
to
ccb4278
Compare
In which situation would |
@smlx It should be useful if someone e.g. runs a recursive chmod over lots of files. While Another important point here is that the change detection should be as strict as possible. When a filesystem has proper inodes then it's a good idea to use that information source to detect file changes. |
a3628e9
to
1e0d98a
Compare
I think I've addressed all review comments now, and I've rebased on current master. |
@greatroar Thanks for the fixes so far, from what I see there are still three unaddressed comments in my last review which are hidden by default by Github. |
1e0d98a
to
4fe5abe
Compare
Sorry, I'd missed them indeed. Addressed now. |
Regarding the naming, would you agree with the following:
I'm thinking that the latter misconception is worse than the former, and also messier to explain/clarify in description and docs. The former is such a small misconception that it can be clarified in the description of the option alone. Hence I'm thinking --ignore-ctime might be a better name after all (assuming a description that mentions it's just ignored for scanning). Thoughts? |
I remember now why the ctime test was skipped on Windows previously: there is no ctime on Windows, so nothing is being tested. I disabled it again, because a skipped test is more informative than one that succeeds without testing anything. |
cf96616
to
d757a34
Compare
@rawtaz Worse, trust-mtime might be taken to imply that the inode is not checked, while it exists explicitly to check the inode but not the ctime. Maybe ignore-ctime is the right choice after all. It's just that it looks very much like ignore-atime, but does something completely different... |
d757a34
to
861974f
Compare
Did you mean In relation to So we're already at a point where the option name doesn't explain the entire picture, and I think that with this in mind and the small discrepancies that Can you verify that if ctime changed but mtime did not, and one used e.g. |
Yes, I meant with-atime. Brain fart, never mind :)
|
@greatroar Thanks a lot for verifying and in particular for showing how you did it so people (including me, I never used So, the Since what |
861974f
to
c466358
Compare
Changed to --ignore-ctime and added some more discussion of device numbers inspired by #3041. |
I'd like to flip the changelog and documentation so that instead of talking about what restic does to determine if things didn't change, it talks about what it does to determine if things did change, because that is what the average user thinks of. They think in terms of restic scanning things to determine what changed and not. It'd be easier for a person reading the text to understand it. |
@rawtaz Please provide some example text. My proposed text starts off by saying everything gets scanned, then lists the conditions where scanning can be skipped. I don't see how to do it the other way around without getting very verbose. |
@rawtaz Did you have something like
in mind for the changelog? And for the documentation e.g. the following?
|
Thanks a lot for all your work on this! For the record, in the forum we've had a case of restic rescanning all data apparently because adding a hard link to a file changes the ctime: https://forum.restic.net/t/randomly-needs-to-rescan-all-data/3366/34 |
Thank you so much greatroar, and sincere apologies for the delay over cosmetics (although it did feel a bit important). |
What is the purpose of this change? What does it change?
Since restic 0.9.6, restic backup has required both the ctime and mtime on a file to match with a previously backed-up version for the file to skipped on Unix. Before 0.9.6, if the mtime matched but the ctime did not, restic backup would not rehash the file.
This PR introduces a --trust-mtime flag to restore the 0.9.5 behavior. Perhaps more importantly, it documents the rules used to determine whether a file can be skipped, since the description in the manual was incomplete and out of date.
The --ignore-inode flag already turned off the ctime check, but also removed a different check; its description in the manual was also in the wrong place.
Changes in metadata are still recorded, regardless of command line options. (This seems to have confused people in previous discussions, so it's worth pointing out.)
Was the change discussed in an issue or in the forum before?
Closes #2558. I took the flag name from Git, because the suggested --ignore-ctime suggests that the ctime is ignored also for metadata changes.
Closes #2503.
Closes #2495. There, @fd0 suggested --use-mtime, but that's confusing because the mtime is always used. @rawtaz suggested --change-detect=mtime, but it's unclear what the other behaviors should be called (ctime+mtime? ctime+mtime+inode?).
Probably fixes #2819.
Checklist
changelog/unreleased/
that describes the changes for our users (template here)gofmt
on the code in all commits