• Marko Mäkelä's avatar
    MDEV-25919: Replace dict_table_t::stats_bg_flag with MDL · 45a05fda
    Marko Mäkelä authored
    The purpose of dict_table_t::stats_bg_flag was to prevent
    race conditions between DDL operations and a background thread
    that updates persistent statistics for InnoDB tables.
    
    Now that with the parent commit, we started to acquire a
    shared meta-data lock (MDL) on the InnoDB persistent statistics tables
    in background tasks that access them, we may easily acquire MDL
    on the table for which the statistics are being updated. This will by
    design prevent race conditions with any DDL operations on that table,
    and the stats_bg_flag may be removed.
    
    dict_stats_process_entry_from_recalc_pool(): Complete rewrite.
    During the processing, retain the entry in recalc_pool, so
    that dict_stats_recalc_pool_del() will be able to request
    deletion of the entry, or delete the entry if its caller is
    holding MDL_EXCLUSIVE while we are waiting for MDL.
    
    recalc_pool: In addition to the table ID, store a state for
    inter-thread communication, so that dict_stats_recalc_pool_del()
    can wait until all processing is finished.
    
    Reviewed by: Thirunarayanan Balathandayuthapani
    45a05fda
dict0stats.cc 121 KB