mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Bannier <benjamin.bann...@mesosphere.io>
Subject Re: Review Request 69085: Stout: Always `fsync` created directories in POSIX `mkdir`.
Date Thu, 25 Oct 2018 13:20:56 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/69085/#review210033
-----------------------------------------------------------


Fix it, then Ship it!




LGTM modulo minor suggestions.

Like I already said, I believe `os::mkdir` is not a great abstraction, but that didn't appear
with this patch.

* Recursive `mkdir` might fail but still create some directories. Users are expected to manually
detect themself what failed and possibly roll back.
* Inconsistent error semantics for existing directories between `recursive` `true` and `false`.


3rdparty/stout/include/stout/os/posix/mkdir.hpp
Lines 33-35 (patched)
<https://reviews.apache.org/r/69085/#comment294674>

    It would be nice to call out the (non-existing) guarantees in case of failure here, e.g.,
    ```
    // Make a directory.
    //
    // If `recursive` is set to true, all intermediate directories
    // will be created as required. `fsync()` will be called on the parent of each
    // created directory to ensure that the result is commited to its filesystem.
    //
    // Note that in case of failures no cleanup is performed by this function
    // itself.
    ```



3rdparty/stout/include/stout/os/posix/mkdir.hpp
Lines 63 (patched)
<https://reviews.apache.org/r/69085/#comment294676>

    Just an observation: This function has different error semantics depending on whether
`recursive` was `true` or `false`, i.e., `mkdir("/tmp", true)` would likely error while `mkdir("/tmp",
false)` would not.
    
    Nothing we should do something about right now, just another indication that this function
isn't a great abstraction.



3rdparty/stout/include/stout/os/posix/mkdir.hpp
Lines 67-72 (patched)
<https://reviews.apache.org/r/69085/#comment294675>

    Do we want to `fsync` directory entries which existed previously? I guess these could
only appear unsynced if they were created by a user directly calling `::mkdir`, or from a
external process.
    
    I'd suggest to just move this block out of the `else` (which could go away), and execute
it unconditionally.


- Benjamin Bannier


On Oct. 25, 2018, 1:02 a.m., Chun-Hung Hsiao wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/69085/
> -----------------------------------------------------------
> 
> (Updated Oct. 25, 2018, 1:02 a.m.)
> 
> 
> Review request for mesos, Benjamin Bannier, Jie Yu, and Jan Schlicht.
> 
> 
> Bugs: MESOS-9281
>     https://issues.apache.org/jira/browse/MESOS-9281
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> To ensure the directories created by `mkdir` are commited to their
> filesystems, an `fsync` will be called on the parent of each created
> directory.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/stout/os/posix/mkdir.hpp 418db9af310ed763a5ae4735c2ebdd1ca38738ba

> 
> 
> Diff: https://reviews.apache.org/r/69085/diff/2/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Chun-Hung Hsiao
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message