• Marko Mäkelä's avatar
    MDEV-30136: Deprecate innodb_flush_method · 24648768
    Marko Mäkelä authored
    We introduce the following settable Boolean global variables:
    
    innodb_log_file_write_through: Whether writes to ib_logfile0 are
    write-through (disabling any caching, as in O_SYNC or O_DSYNC).
    
    innodb_data_file_write_through: Whether writes to any InnoDB data files
    (including the temporary tablespace) are write-through.
    
    innodb_data_file_buffering: Whether the file system cache is enabled
    for InnoDB data files.
    
    All these parameters are OFF by default, that is, the file system cache
    will be disabled, but any hardware caching is enabled, that is,
    explicit calls to fsync(), fdatasync() or similar functions are needed.
    
    On systems that support FUA it may make sense to enable write-through,
    to avoid extra system calls.
    
    If the deprecated read-only start-up parameter is set to one of the
    following values, then the values of the 4 Boolean flags (the above 3
    plus innodb_log_file_buffering) will be set as follows:
    
    O_DSYNC:
    innodb_log_file_write_through=ON, innodb_data_file_write_through=ON,
    innodb_data_file_buffering=OFF, and
    (if supported) innodb_log_file_buffering=OFF.
    
    fsync, littlesync, nosync, or (Microsoft Windows specific) normal:
    innodb_log_file_write_through=OFF, innodb_data_file_write_through=OFF,
    and innodb_data_file_buffering=ON.
    
    Note: fsync() or fdatasync() will only be disabled if the separate
    parameter debug_no_sync (in the code, my_disable_sync) is set.
    
    In mariadb-backup, the parameter innodb_flush_method will be ignored.
    
    The Boolean parameters can be modified by SET GLOBAL while the
    server is running. This will require reopening the ib_logfile0
    or all currently open InnoDB data files.
    
    We will open files straight in O_DSYNC or O_SYNC mode when applicable.
    Data files we will try to open straight in O_DIRECT mode when the
    page size is at least 4096 bytes. For atomically creating data files,
    we will invoke os_file_set_nocache() to enable O_DIRECT afterwards,
    because O_DIRECT is not supported on some file systems. We will also
    continue to invoke os_file_set_nocache() on ib_logfile0 when
    innodb_log_file_buffering=OFF can be fulfilled.
    
    For reopening the ib_logfile0, we use the same logic that was developed
    for online log resizing and reused for updates of
    innodb_log_file_buffering.
    
    Reopening all data files is implemented in the new function
    fil_space_t::reopen_all().
    
    Reviewed by: Vladislav Vaintroub
    Tested by: Matthias Leich
    24648768
buf0flu.cc 80 KB