• Konstantin Osipov's avatar
    Backport of: · c44665ae
    Konstantin Osipov authored
    ------------------------------------------------------------
    revno: 3035.4.1
    committer: Davi Arnaut <Davi.Arnaut@Sun.COM>
    branch nick: 39897-6.0
    timestamp: Thu 2009-01-15 12:17:57 -0200
    message:
    Bug#39897: lock_multi fails in pushbuild: timeout waiting for processlist
    
    The problem is that relying on the "Table lock" thread state in
    its current position to detect that a thread is waiting on a lock
    is race prone. The "Table lock" state change happens before the
    thread actually tries to grab a lock on a table.
    
    The solution is to move the "Table lock" state so that its set
    only when a thread is actually going to wait for a lock. The state
    change happens after the thread fails to grab the lock (because it
    is owned by other thread) and proceeds to wait on a condition.
    
    This is considered part of work related to WL#4284 "Transactional
    DDL locking"
    Warning: this patch contains an incompatible change. 
    When waiting on a lock in thr_lock.c, the server used to display "Locked"
    processlist state. After this patch, the state is "Table lock".
    The new state was actually intended to be display since year 2002,
    when Monty added it. But up until removal of thd->locked boolean
    member, this state was ignored by SHOW PROCESSLIST code.  
    c44665ae
multi_update.test 19.7 KB