• Krunal Bauskar's avatar
    MDEV-25882: Statistics used to track b-tree (non-adaptive) searches · 102ff420
    Krunal Bauskar authored
                should be updated only when adaptive hashing is turned-on
    
    Currently, btr_cur_n_non_sea is used to track the search that missed
    adaptive hash index. adaptive hash index is turned off by default
    but the said variable is updated always though the value of it makes sense
    only when an adaptive index is enabled. It is meant to check how many
    searches didn't go through an adaptive hash index.
    
    Given a global variable that is updated on each search path it causes
    a contention with a multi-threaded workload.
    
    Patch moves the said variables inside a loop that is now updated
    only when the adaptive hash index is enabled and that in theory should
    also, reduce the update frequency of the said variable as the majority of
    the request should be serviced through the adaptive hash index.
    
    Variables (btr_cur_n_non_sea and btr_cur_n_sea) are also converted to
    use distributed counter to avoid contention.
    
    User visible changes:
    
    This also means that user will now see
    Innodb_adaptive_hash_non_hash_searches (viewed as part of show status)
    only if code is compiled with DWITH_INNODB_AHI=ON (default) and it will
    be updated only if innodb_adaptive_hash_index=1 else it reported as 0.
    102ff420
srv0srv.cc 61.8 KB