• Emmanuel T Odeke's avatar
    internal/poll: use F_FULLFSYNC fcntl for FD.Fsync on OS X · be10ad76
    Emmanuel T Odeke authored
    As reported in #26650 and also cautioned on the man page
    for fsync on OS X, fsync doesn't properly flush content
    to permanent storage, and might cause corruption of data if
    the OS crashes or if the drive loses power. Thus it is recommended
    to use the F_FULLFSYNC fcntl, which flushes all buffered data to
    permanent storage and is important for applications such as
    databases that require a strict ordering of writes.
    
    Also added a note in syscall_darwin.go that syscall.Fsync is
    not invoked for os.File.Sync.
    
    Fixes #26650.
    
    Change-Id: Idecd9adbbdd640b9c5b02e73b60ed254c98b48b6
    Reviewed-on: https://go-review.googlesource.com/130676
    Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
    Run-TryBot: Ian Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    be10ad76
fd_fsync_posix.go 437 Bytes