• Marko Mäkelä's avatar
    MDEV-25121: innodb_flush_method=O_DIRECT fails on compressed tables · 12672542
    Marko Mäkelä authored
    Tests with 4096-byte sector size confirm that it is
    safe to use O_DIRECT with page_compressed tables.
    That had been disabled on Linux, in an attempt to fix MDEV-21584
    which had been filed for the O_DIRECT problems earlier.
    
    The fil_node_t::block_size was being set mostly correctly until
    commit 10dd290b (MDEV-17380)
    introduced a regression in MariaDB Server 10.4.4.
    
    fil_node_open_file(): Only avoid setting O_DIRECT on
    ROW_FORMAT=COMPRESSED tables that use KEY_BLOCK_SIZE=1 or 2
    (1024 or 2048 bytes).
    
    fil_ibd_create(): Avoid setting O_DIRECT on ROW_FORMAT=COMPRESSED tables
    that use KEY_BLOCK_SIZE=1 or 2 (1024 or 2048 bytes).
    
    fil_node_t::find_metadata(): Require fstat() to be always invoked
    outside Microsoft Windows, so that fil_node_t::block_size can be set.
    
    fil_node_t::read_page0(): Rely on find_metadata() to assign block_size.
    
    Thanks to Vladislav Vaintroub for testing this on Microsoft Windows
    using an old-fashioned rotational hard disk with 4KiB sector size.
    
    Reviewed by: Vladislav Vaintroub
    
    This is a port of commit 00f620b2
    and commit 6505662c from 10.2.
    12672542
fil0fil.cc 135 KB