• Marko Mäkelä's avatar
    MDEV-12602 InnoDB: Failing assertion: space->n_pending_ops == 0 · 4b24467f
    Marko Mäkelä authored
    This fixes a regression caused by MDEV-12428.
    When we introduced a variant of fil_space_acquire() that could
    increment space->n_pending_ops after space->stop_new_ops was set,
    the logic of fil_check_pending_operations() was broken.
    
    fil_space_t::n_pending_ios: A new field to track read or write
    access from the buffer pool routines immediately before a block
    write or after a block read in the file system.
    
    fil_space_acquire_for_io(), fil_space_release_for_io(): Similar
    to fil_space_acquire_silent() and fil_space_release(), but
    modify fil_space_t::n_pending_ios instead of fil_space_t::n_pending_ops.
    
    fil_space_free_low(): Wait for space->n_pending_ios to reach 0,
    to avoid accessing freed data in a concurrent thread. Future
    calls to fil_space_acquire_for_io() will not find this tablespace,
    because it will already have been detached from fil_system.
    
    Adjust a number of places accordingly, and remove some redundant
    tablespace lookups.
    
    FIXME: buf_page_check_corrupt() should take a tablespace from
    fil_space_acquire_for_io() as a parameter. This will be done
    in the 10.1 version of this patch and merged from there.
    That depends on MDEV-12253, which has not been merged from 10.1 yet.
    4b24467f
buf0buf.h 83.5 KB