• Marko Mäkelä's avatar
    MDEV-24313 (1 of 2): Hang with innodb_write_io_threads=1 · 17d3f856
    Marko Mäkelä authored
    After commit a5a2ef07 (part of MDEV-23855)
    implemented asynchronous doublewrite, it is possible that the server will
    hang when the following parametes are in effect:
    
        innodb_doublewrite=1 (default)
        innodb_write_io_threads=1
        innodb_use_native_aio=0
    
    Note: In commit 5e62b6a5 (MDEV-16264)
    the logic of os_aio_init() was changed so that it will never fail,
    but instead automatically disable innodb_use_native_aio (which is
    enabled by default) if the io_setup() system call would fail due
    to resource limits being exceeded.
    
    Before commit a5a2ef07, we used
    a synchronous write for the doublewrite buffer batches, always at
    most 64 pages at a time. So, upon completing a doublewrite batch,
    a single thread would submit at most 64 page writes (for the
    individual pages that were first written to the doublewrite buffer).
    With that commit, we may submit up to 128 page writes at a time.
    
    The maximum number of outstanding requests per thread is 256.
    Because the maximum number of asynchronous write submissions per
    thread was roughly doubled, it is now possible that
    buf_dblwr_t::flush_buffered_writes_completed() will hang in
    io_slots::acquire(), called via os_aio() and fil_space_t::io(),
    when submitting writes of the individual blocks.
    
    We will prevent this type of hang by increasing the minimum number
    of innodb_write_io_threads from 1 to 2, so that this type of hang
    would only become possible when 512 outstanding write requests
    are exceeded.
    17d3f856
ha_innodb.cc 617 KB