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
Examine file ctime when checking if files have changed. #2212
Conversation
It looks like this change is breaking #2205 (or at least its unit tests). How do we want these to interact? The only idea I've had so far is disabling the ctime check if the ignore inode flag is on, but I'm open to anything that makes sense. |
The |
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.
Thanks for taking a stab at this! This is a change which may leave users wondering what's happening, so we need to be extra careful to address this in the changelog. As far as I understood, there are some situations in which restic did not read the contents of the file, but does now (file with different content, but same length and mtime
and inode). So for people depending on this (there are always people who depend on any behavior, no matter how obscure) will see that restic reads and hashes more files than before. Also, when metadata is changed, the ctime
is updated and the file is re-read.
In my opinion, being correct and re-reading the contents if in doubt is the better strategy, so I'm in favor for this. Maybe we should add a paragraph to the changelog that people should open an issue if this breaks anything for them, so we can decide if we need a flag for it?
We need to clarify the following things before it can be merged:
- Is it a bug or an enhancement (important for the changelog entry)? I'm currently leaning towards the latter, but I'm open to arguments.
- The code needs to be rebased on master, the conflict with the ignore-inode option needs to be resolved
- When
--ignore-inode
is turned on, I think thectime
should not be considered so I agree with @d3zd3z
Codecov Report
@@ Coverage Diff @@
## master #2212 +/- ##
==========================================
- Coverage 50.92% 46.86% -4.06%
==========================================
Files 178 178
Lines 14530 14534 +4
==========================================
- Hits 7399 6812 -587
- Misses 6058 6700 +642
+ Partials 1073 1022 -51
Continue to review full report at Codecov.
|
OK, I rebased against master, and it now skips the ctime check when the |
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, thanks!
file should be noticed, and the modified file will be backed up. The ctime check | ||
will be disabled if the --ignore-inode flag was given. | ||
|
||
If this change causes problems for you, please open an issue, and we can look in |
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.
I love the wording!
@@ -576,6 +577,19 @@ func TestFileChanged(t *testing.T) { | |||
save(t, filename, defaultContent) | |||
}, | |||
}, | |||
{ | |||
Name: "new-content-same-timestamp", |
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.
Table-driven tests are awesome, easily extendable for contributors! :)
Examine file ctime when checking if files have changed.
Please excuse me, but shouldn't we be giving more warning to users about this problem? Please see my rationale here. |
What is the purpose of this change? What does it change?
This makes restic compare file ctimes (in addition to all of the existing checks) when it is deciding if a file has been modified.
Was the change discussed in an issue or in the forum before?
Yes, closes #2179.
Checklist
changelog/unreleased/
that describes the changes for our users (template here)gofmt
on the code in all commits