• Konstantin Osipov's avatar
    WL#5419 "LOCK_open scalability: make tdc_refresh_version · 33c57e2f
    Konstantin Osipov authored
    an atomic counter"
    
    Split the large LOCK_open section in open_table(). 
    Do not call open_table_from_share() under LOCK_open.
    Remove thd->version.
    
    This fixes
    Bug#50589 "Server hang on a query evaluated using a temporary 
    table"
    Bug#51557 "LOCK_open and kernel_mutex are not happy together"
    Bug#49463 "LOCK_table and innodb are not nice when handler 
    instances are created".
    
    This patch has effect on storage engines that rely on
    ha_open() PSEA method being called under LOCK_open.
    In particular:
    
    1) NDB is broken and left unfixed. NDB relies on LOCK_open
    being kept as part of ha_open(), since it uses auto-discovery.
    While previously the NDB open code was race-prone, now
    it simply fails on asserts.
    
    2) HEAP engine had a race in ha_heap::open() when
    a share for the same table could be added twice
    to the list of shares, or a dangling reference to a share
    stored in HEAP handler. This patch aims to address this
    problem by 'pinning' the newly created share in ...
    33c57e2f
sql_plugin.cc 101 KB