Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Implement RandomAccess.FlushToDisk() #89100
Implement RandomAccess.FlushToDisk() #89100
Changes from 3 commits
eca321a
be1e81c
32dcdb2
a7d6289
4748b8a
276f2c1
8ab5bee
54a3215
749d9b8
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
consider setting a last write time here that's a little older. otherwise you'll fail when the file system timestamp granularity isn't high enough. at an extreme, this test will fail on a FAT32 partition.
also, this test will fail if a daylight savings change or leap second happens during the test. obviously, that's unlikely, but several of our tests fail every time there's such an event as there's zillions of tests and they run all the time. to fix that, you can set a date that's a year ago, for example.
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.
Interesting points @danmoseley! In this test we are not explicitly setting the last write time so I can't control it in any way. When the file is flushed, it is the operating system that updates the last write time and the test is just checking that the time after flushing is greater than the time before flushing (or that they are at least equal, as explained in the comment near the
Assert
at the end).The most important comment in the test says:
...i.e. we are mostly interested in the fact that flushing works without throwing an exception on all platforms. So I can remove all the date-related asserts to avoid the issues you raised. Please let me know if I should do this 👍
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.
another reason to set your own older timestamp before the flush is you eliminate this race. and then you can use Assert.NotEqual here instead. which also has the advantage that if it fails, it will be clear why, whereas when you use Assert.True it just says false expected true.
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.
Please see this response, I believe the decision we make there will address this too 👍