Skip to content
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

Synchronize files after writing #10735

Merged
merged 1 commit into from
May 13, 2024
Merged

Synchronize files after writing #10735

merged 1 commit into from
May 13, 2024

Commits on May 12, 2024

  1. Synchronize files after writing

    fsync(2) is a somewhat expensive operation that flushes writes to the
    underlying disk/SSD. It's typically used by databases to ensure that
    writes survive very hard failure scenarios like your cat kicking the
    plug out of the wall. Synchronizing isn't automatically done by
    `flush`ing (from the `std::io::Write` or `tokio::io::AsyncWriteExt`
    traits). From the [`tokio::fs::File`] moduledocs:
    
    > To ensure that a file is closed immediately when it is dropped, you
    > should call `flush` before dropping it. Note that this does not ensure
    > that the file has been fully written to disk; the operating system
    > might keep the changes around in an in-memory buffer. See the
    > `sync_all` method for telling the OS to write the data to disk.
    
    [`tokio::fs::File`]: https://docs.rs/tokio/latest/tokio/fs/struct.File.html
    the-mikedavis committed May 12, 2024
    Configuration menu
    Copy the full SHA
    5f9f5ba View commit details
    Browse the repository at this point in the history