A dirstate update that appends data to the treedirstate tree file, followed by
a hard reboot before the filesystem cache is flushed, can result in a dirstate
tree root that is referred to by the dirstate file, but does not contain the
correct data. Ensure the appended data is synced to disk before returning from
Store.flush().
Details
Details
- Reviewers
ikostia - Group Reviewers
Restricted Project - Commits
- rFBHGX37bccca1426f: treedirstate: ensure appended data is flushed to disk
Diff Detail
Diff Detail
- Repository
- rFBHGX Facebook Mercurial Extensions
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
rust/treedirstate/src/filestore.rs | ||
---|---|---|
157 | This should probably be sync_all(), since you do want to sync metadata as well (the file size). There's no guarantee that sync_data() will also sync the file size change, meaning that your data is safely written but inaccessible after the logical end of the file. (It is intended for overwrite cases where you want to write into the middle of a file and don't care whether the mtime update is durable.) |
This should probably be sync_all(), since you do want to sync metadata as well (the file size). There's no guarantee that sync_data() will also sync the file size change, meaning that your data is safely written but inaccessible after the logical end of the file. (It is intended for overwrite cases where you want to write into the middle of a file and don't care whether the mtime update is durable.)