• Marko Mäkelä's avatar
    MDEV-32050: Look up tables in the purge coordinator · 88733282
    Marko Mäkelä authored
    The InnoDB table lookup in purge worker threads is a bottleneck that can
    degrade a slow shutdown to utilize less than 2 threads. Let us fix that
    bottleneck by constructing a local lookup table that does not require any
    synchronization while the undo log records of the current batch
    are being processed.
    
    TRX_PURGE_TABLE_BUCKETS: The initial number of std::unordered_map
    hash buckets used during a purge batch. This could avoid some
    resizing and rehashing in trx_purge_attach_undo_recs().
    
    purge_node_t::tables: A lookup table from table ID to an already
    looked up and locked table. Replaces many fields.
    
    trx_purge_attach_undo_recs(): Look up each table in the purge batch
    only once.
    
    trx_purge(): Close all tables and release MDL at the end of the batch.
    
    trx_purge_table_open(), trx_purge_table_acquire(): Open a table in purge
    and acquire a metadata lock on it. This replaces
    dict_table_open_on_id<true>() and dict_acquire_mdl_shared().
    
    purge_sys_t::close_and_reopen(): In case of an MDL conflict, close and
    reopen all tables that are covered by the current purge batch.
    It may be that some of the tables have been dropped meanwhile and can
    be ignored. This replaces wait_SYS() and wait_FTS().
    
    row_purge_parse_undo_rec(): Make purge_coordinator_task issue a
    MDL warrant to any purge_worker_task which might need it
    when innodb_purge_threads>1.
    
    purge_node_t::end(): Clear the MDL warrant.
    
    Reviewed by: Vladislav Lesin and Vladislav Vaintroub
    88733282
innodb-index-debug.result 15.3 KB