• Dmitry Lenev's avatar
    Fix for sporadical crashes of lock_multi_bug38499.test · 19940fa7
    Dmitry Lenev authored
    caused by patch which implemented new type-of-operation-aware
    metadata locks and added a wait-for graph based deadlock
    detector to the MDL subsystem (this patch fixed bug #46272
    "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346
    "innodb does not detect deadlock between update and alter
    table").
    
    Crashes were caused by a race in MDL_context::try_acquire_lock().
    This method added MDL_ticket to the list of granted tickets and
    released lock protecting list before setting MDL_ticket::m_lock.
    Thus some other thread was able to see ticket without properly
    set m_lock member for some short period of time. If this thread
    called method involving this member during this period crash
    happened.
    
    This fix ensures that MDL_ticket::m_lock is set in all cases
    when ticket is added to granted/pending lists in MDL_lock.
    19940fa7
mdl.cc 62 KB