• Dmitry Lenev's avatar
    Fix for bug #50998 "Deadlock in MDL code during test · f229ac07
    Dmitry Lenev authored
    rqg_mdl_stability".
    
    When start of statement's waiting on a metadata lock 
    created more than one loop in waiters graph server might 
    have entered deadlock condition.
    
    The problem was that in the case described above MDL deadlock 
    detector had to perform several searches for deadlock but
    forgot to reset Deadlock_detection_context before performing 
    new search. 
    Failure to do so has broken assumption in code resposible for 
    choosing victim that if Deadlock_detection_context::victim
    is set we also have read lock on m_waiting_for_lock for this
    context. As result this lock could have been unlocked more
    times than it was acquired which corrupted rwlock's state
    which led to server deadlock.
    
    This fix ensures that such reset is done before each attempt
    to find a deadlock.
    f229ac07
mdl_sync.result 64.3 KB