请问:http://forums.mysql.com/read.php?22,73439,73439
是何意思?

解决方案 »

  1.   

    Lock wait timeout exceeded; try restarting transaction你的事务在等待给某个表加锁时超时了,估计是表正被另的进程锁住一直没有释放。可以用 SHOW INNODB STATUS\G;  看一下锁的情况。
    
      

  2.   

    我用:SHOW innodb status\g:
    提示:
    [code=BatchFile]
    Status:
    =====================================
    090618 11:19:41 INNODB MONITOR OUTPUT
    =====================================
    Per second averages calculated from the last 24 seconds
    ----------
    SEMAPHORES
    ----------
    OS WAIT ARRAY INFO: reservation count 325, signal count 321
    Mutex spin waits 0, rounds 7518, OS waits 64
    RW-shared spins 477, OS waits 230; RW-excl spins 33, OS waits 7
    ------------
    TRANSACTIONS
    ------------
    Trx id counter 0 248857
    Purge done for trx's n:o < 0 246278 undo n:o < 0 0
    History list length 35
    Total number of lock structs in row lock hash table 1
    LIST OF TRANSACTIONS FOR EACH SESSION:
    ---TRANSACTION 0 0, not started, process no 6771, OS thread id 2948840336
    MySQL thread id 230371, query id 2996547 124.207.47.194 root
    SHOW INNODB STATUS
    ---TRANSACTION 0 248617, not started, process no 6771, OS thread id 2953726864
    MySQL thread id 228504, query id 2975218 124.207.47.194 root
    ---TRANSACTION 0 248856, not started, process no 6771, OS thread id 2950937488
    MySQL thread id 219929, query id 2996450 124.207.47.194 root
    ---TRANSACTION 0 248855, not started, process no 6771, OS thread id 2949442448
    MySQL thread id 219921, query id 2996491 124.207.47.194 root
    ---TRANSACTION 0 247081, not started, process no 6771, OS thread id 2954328976
    MySQL thread id 218565, query id 2878672 211.147.6.208 root
    ---TRANSACTION 0 247074, not started, process no 6771, OS thread id 2951138192
    MySQL thread id 218564, query id 2878683 211.147.6.208 root
    ---TRANSACTION 0 247064, not started, process no 6771, OS thread id 2949643152
    MySQL thread id 218546, query id 2878676 211.147.6.208 root
    ---TRANSACTION 0 247069, not started, process no 6771, OS thread id 2951539600
    MySQL thread id 217303, query id 2878678 211.147.6.208 root
    ---TRANSACTION 0 247838, not started, process no 6771, OS thread id 2953927568
    MySQL thread id 214622, query id 2892035 124.207.47.194 root
    ---TRANSACTION 0 246271, ACTIVE 7438 sec, process no 6771, OS thread id 2951740
    04
    2 lock struct(s), heap size 320, undo log entries 8
    MySQL thread id 217302, query id 2878649 211.147.6.208 root
    Trx read view will not see trx with id >= 0 246272, sees < 0 246253
    ---TRANSACTION 0 246269, ACTIVE 7438 sec, process no 6771, OS thread id 2953124
    52
    1 lock struct(s), heap size 320
    MySQL thread id 217301, query id 2874752 211.147.6.208 root
    Trx read view will not see trx with id >= 0 246270, sees < 0 246253
    ---TRANSACTION 0 246262, ACTIVE 7440 sec, process no 6771, OS thread id 2953526
    60
    1 lock struct(s), heap size 320
    MySQL thread id 217300, query id 2892090 211.147.6.208 root
    Trx read view will not see trx with id >= 0 246263, sees < 0 246253
    ---TRANSACTION 0 246260, ACTIVE 7444 sec, process no 6771, OS thread id 2953325
    56
    1 lock struct(s), heap size 320
    MySQL thread id 217299, query id 2878553 211.147.6.208 root
    Trx read view will not see trx with id >= 0 246261, sees < 0 246253
    ---TRANSACTION 0 246253, ACTIVE 7448 sec, process no 6771, OS thread id 2954128
    72
    1 lock struct(s), heap size 320
    MySQL thread id 214621, query id 2878582 211.147.6.208 root
    Trx read view will not see trx with id >= 0 246254, sees < 0 246254
    --------
    FILE I/O
    --------
    I/O thread 0 state: waiting for i/o request (insert buffer thread)
    I/O thread 1 state: waiting for i/o request (log thread)
    I/O thread 2 state: waiting for i/o request (read thread)
    I/O thread 3 state: waiting for i/o request (write thread)
    Pending normal aio reads: 0, aio writes: 0,
     ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0
    Pending flushes (fsync) log: 0; buffer pool: 0
    105 OS file reads, 1794 OS file writes, 1183 OS fsyncs
    0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
    -------------------------------------
    INSERT BUFFER AND ADAPTIVE HASH INDEX
    -------------------------------------
    Ibuf: size 1, free list len 0, seg size 2,
    0 inserts, 0 merged recs, 0 merges
    Hash table size 34679, used cells 169, node heap has 1 buffer(s)
    0.00 hash searches/s, 0.00 non-hash searches/s
    ---
    LOG
    ---
    Log sequence number 0 6767238
    Log flushed up to   0 6767238
    Last checkpoint at  0 6767238
    0 pending log writes, 0 pending chkp writes
    632 log i/o's done, 0.00 log i/o's/second
    ----------------------
    BUFFER POOL AND MEMORY
    ----------------------
    Total memory allocated 18409010; in additional pool allocated 1047168
    Buffer pool size   512
    Free buffers       392
    Database pages     119
    Modified db pages  0
    Pending reads 0
    Pending writes: LRU 0, flush list 0, single page 0
    Pages read 114, created 5, written 964
    0.00 reads/s, 0.00 creates/s, 0.00 writes/s
    Buffer pool hit rate 1000 / 1000
    --------------
    ROW OPERATIONS
    --------------
    0 queries inside InnoDB, 0 queries in queue
    6 read views open inside InnoDB
    Main thread process no. 6771, id 2996517776, state: sleeping
    Number of rows inserted 168, updated 158, deleted 36, read 200449
    0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
    ----------------------------
    END OF INNODB MONITOR OUTPUT
    ============================1 row in set, 1 warning (0.01 sec)[/code]