• Marko Mäkelä's avatar
    MDEV-25051 Race condition between persistent statistics and RENAME TABLE or TRUNCATE · 978e48c9
    Marko Mäkelä authored
    innobase_rename_table(): Invoke dict_stats_wait_bg_to_stop_using_table()
    to ensure that dict_stats_update() cannot be accessing the table name
    that we will be modifying. If we are executing RENAME rather than TRUNCATE,
    reset the flag at the end so that persistent statistics can be calculated
    again.
    
    The race condition was encountered with ASAN and rr.
    Sorry, there is no test case, like there is for nothing related to
    dict_stats_wait_bg_to_stop_using_table(). The entire code is an ugly
    work-around for the failure of dict_stats_process_entry_from_recalc_pool()
    to acquire MDL.
    
    Note: It appears that an ALTER TABLE that is not rebuilding the table
    will fail to reset the flag that blocks the processing of statistics.
    978e48c9
ha_innodb.cc 642 KB