• Marko Mäkelä's avatar
    MDEV-23026/MDEV-25474 fixup: Assertion ib_table->stat_initialized · 14a18d7d
    Marko Mäkelä authored
    It is possible that an object that was originally created by
    open_purge_table() will remain cached and reused for SQL execution.
    Our previous fix wrongly assumed that ha_innobase::open() would
    always be called before SQL execution starts. Therefore, we must
    invoke dict_stats_init() in ha_innobase::info_low() instead of
    only doing it in ha_innobase::open().
    
    Note: Concurrent execution of dict_stats_init() on the same table
    is possible, but it also was possible between two calls to
    ha_innobase::open(), with no ill effects observed.
    
    This should fix the assertion failure on stat_initialized.
    A possibly easy way to reproduce it would have been
    to run the server with innodb_force_recovery=2 (disable the purge of
    history), update a table so that an indexed virtual column will be
    affected, and finally restart the server normally (purge enabled),
    to observe a crash when the table is accessed from SQL.
    
    The problem was first observed and this fix verified by
    Elena Stepanova. Also Thirunarayanan Balathandayuthapani
    repeated the problem.
    14a18d7d
ha_innodb.cc 644 KB