• Varun Gupta's avatar
    MDEV-13266: Race condition in ANALYZE TABLE / statistics collection · 06b245f7
    Varun Gupta authored
    Fixing a race condition while collecting the engine independent statistics.
    
    Thread1>
    1) start running "ANALYZE TABLE t PERISTENT FOR COLUMNS (..) INDEXES ($list)"
    2) Walk through $list and save it in TABLE::keys_in_use_for_query
    3) Close/re-open tables
    
    Thread2>
    1) Make some use of table t. This involves taking table t from
       the table cache, and putting it back (with TABLE::keys_in_use_for_query reset to 0)
    
    Thread1>
    continue collecting EITS stats. Since TABLE::keys_in_use_for_query is set to 0 we
    will not collect statistics for indexes in $list.
    06b245f7
sql_admin.cc 48.2 KB