• Sergei Golubchik's avatar
    MDEV-27767 poor scaling with InnoDB and utf8mb3 because of charset stats · fc839644
    Sergei Golubchik authored
    Access the all_charsets[] array directly in a hot loop.
    This avoids get_charset() that increments a shared counter via
    my_collation_statistics_inc_use_count(), causing a scalability issue.
    
    Instead, call get_charset() when a table is opened (and InnoDB
    fills in dtype_t values) - this is enough, as charset is marked
    ready (MY_CS_READY) only once, on the first get_charset() call,
    after that it can be accessed directly.
    
    This also fixes a potential bug in InnoDB. It used to access charsets
    directly when filling dtype_t values. This wasn't preceded by any
    get_charset() call inside InnoDB. Normally the server would call
    get_charset() on reading the frm, but if the table was first opened
    from a purge thread InnoDB could, theoretically, access a not-ready
    charset in innobase_get_cset_width().
    fc839644
rem0cmp.cc 26.4 KB