• Konstantin Osipov's avatar
    Backport of: · cd155be5
    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.  
    
    mysql-test/r/lock_multi.result:
      A style fix.
    mysql-test/r/sp-threads.result:
      Changed output of SHOW PROCESSLIST (new wait state).
    mysql-test/t/lock_multi.test:
      Use a more accurate state description when waiting inside thr_lock.c.
    mysql-test/t/lock_sync.test:
      Use a more accurate state description when waiting inside thr_lock.c.
    mysql-test/t/multi_update.test:
      Use a more accurate state description when waiting inside thr_lock.c.
    mysql-test/t/query_cache_28249.test:
      Use a more accurate state description when waiting inside thr_lock.c.
    mysql-test/t/sp_notembedded.test:
      Use a more accurate state description when waiting inside thr_lock.c.
    mysql-test/t/status.test:
      Use a more accurate state description when waiting inside thr_lock.c.
    mysys/thr_lock.c:
      Update thread state while waiting for a table lock.
    sql/lock.cc:
      State change was moved inside thr_lock.c.
    cd155be5
insert_notembedded.test 6.4 KB