• Monty's avatar
    Fix for MDEV-9679 main.delayed fails sporadically · 0dbc6649
    Monty authored
    Problem was that notify_shared_lock() didn't abort an insert delayed thread
    if it was in thr_upgrade_write_delay_lock().
    
    ALTER TABLE first takes a weak_mdl_lock, then a thr_lock and then tries to upgrade
    the mdl_lock.
    Delayed insert thread first takes a mdl lock followed by a
    thr_upgrade_write_delay_lock()
    This caused insert delay to wait for alter table in thr_lock, while
    alter table was waiting for the mdl lock by insert delay.
    
    Fixed by telling mdl to run thr_lock_abort() for the insert delay thread table.
    We also set thd->mysys_var->abort to 1 for the delay thread when it's killed
    by alter table to ensure it doesn't ever get locked in thr_lock.
    0dbc6649
sql_class.cc 199 KB