• unknown's avatar
    MDEV-381: fdatasync() does not correctly flush growing binlog file. · 63f6c4e8
    unknown authored
    When we append data to the binlog file, we use fdatasync() to ensure
    the data gets to disk so that crash recovery can work.
    
    Unfortunately there seems to be a bug in ext3/ext4 on linux, so that
    fdatasync() does not correctly sync all data when the size of a file
    is increased. This causes crash recovery to not work correctly (it
    loses transactions from the binlog).
    
    As a work-around, use fsync() for the binlog, not fdatasync(). Since
    we are increasing the file size, (correct) fdatasync() will most
    likely not be faster than fsync() on any file system, and fsync()
    does work correctly on ext3/ext4. This avoids the need to try to
    detect if we are running on buggy ext3/ext4.
    63f6c4e8
log.cc 206 KB