Hi,
I've a problem with MySql, some time I receive the "1205 Lock wait timeout exceeded".
Look the Innodb status get the Lock to be granted is an Index... any idea what else I must check??
SHOW INNODB STATUS show the follow:
=====================================
110822 15:45:15 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 37 seconds
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 394924, signal count 377411
Mutex spin waits 0, rounds 6840373, OS waits 97104
RW-shared spins 603206, OS waits 257034; RW-excl spins 293701, OS waits 31435
------------------------
LATEST DETECTED DEADLOCK
------------------------
110822 12:15:04
*** (1) TRANSACTION:
TRANSACTION 2 398374015, ACTIVE 0 sec, process no 2793, OS thread id 1189280064 fetching rows
mysql tables in use 1, locked 1
LOCK WAIT 140 lock struct(s), heap size 14320, 1802 row lock(s)
MySQL thread id 92014, query id 138425491 localhost 127.0.0.1 [db_name] updating
DELETE FROM `backgroundtask` WHERE ( bt_executed_at is not null and bt_result <> 'error' and bt_executed_at < '2011-08-21 10:15')
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 0 page no 13326 n bits 592 index `bt_result` of table `[db_name]`.`backgroundtask` trx id 2 398374015 lock_mode X waiting
Record lock, heap no 510 PHYSICAL RECORD: n_fields 2; compact format; info bits 0
0: len 7; hex 73756363657373; asc success;; 1: len 4; hex 00040889; asc ;;
*** (2) TRANSACTION:
TRANSACTION 2 398372478, ACTIVE 5 sec, process no 2793, OS thread id 1080637760 inserting, thread declared inside InnoDB 500
mysql tables in use 1, locked 1
43 lock struct(s), heap size 6752, 50 row lock(s), undo log entries 63
MySQL thread id 92011, query id 138425650 localhost 127.0.0.1 [db_name] update
INSERT INTO `backgroundtask` (`bt_created_at`, `bt_description`, `bt_helper`, `bt_method`, `bt_params`, `bt_group_code`, `bt_stacktrace`) VALUES ('2011-08-22 10:15', 'Dispatch order #336', 'Orderpreparation', 'dispatchOrder', 's:3:\"336\";', NULL, '[path_file] (83) : AddTask\n[path_file] (57) : dispatchOrder\n[path_file] (1272) : salesorderitem_aftersave\n[path_file] (1253) : _callObserverMethod\n[path_file] (416) : dispatchEvent\n[path_file] (42) : dispatchEvent\n[path_file]
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 0 page no 13326 n bits 592 index `bt_result` of table `[db_name]`.`backgroundtask` trx id 2 398372478 lock_mode X locks rec but not gap
Record lock, heap no 510 PHYSICAL RECORD: n_fields 2; compact format; info bits 0
0: len 7; hex 73756363657373; asc success;; 1: len 4; hex 00040889; asc ;;
*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 0 page no 13320 n bits 968 index `bt_result` of table `[db_name]`.`backgroundtask` trx id 2 398372478 lock_mode X locks gap before rec insert intention waiting
Record lock, heap no 5 PHYSICAL RECORD: n_fields 2; compact format; info bits 0
0: len 5; hex 6572726f72; asc error;; 1: len 4; hex 00000001; asc ;;
*** WE ROLL BACK TRANSACTION (2)
------------
TRANSACTIONS
------------
Trx id counter 2 399751060
Purge done for trx's n:o < 2 399748843 undo n:o < 0 0
History list length 15
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0 0, not started, process no 2793, OS thread id 1190082880
MySQL thread id 96231, query id 146128410 localhost admin
show innodb status
---TRANSACTION 2 399751058, not started, process no 2793, OS thread id 1191889216
mysql tables in use 2, locked 0
MySQL thread id 96230, query id 146128414 localhost 127.0.0.1 [db_name]
SELECT `cataloginventory_stock_item`.*, `p`.`type_id` FROM `cataloginventory_stock_item`
INNER JOIN `catalog_product_entity` AS `p` ON product_id=p.entity_id WHERE (cataloginventory_stock_item.product_id='11792') AND (stock_id=1)
---TRANSACTION 2 399751059, not started, process no 2793, OS thread id 1193896256
MySQL thread id 96221, query id 146128415 localhost 127.0.0.1 [db_name]
SELECT `cataloginventory_stock_item`.*, `p`.`type_id` FROM `cataloginventory_stock_item`
INNER JOIN `catalog_product_entity` AS `p` ON product_id=p.entity_id WHERE (cataloginventory_stock_item.product_id='8549') AND (stock_id=1)
--------
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
4917890 OS file reads, 798462 OS file writes, 364730 OS fsyncs
78.57 reads/s, 36459 avg bytes/read, 6.49 writes/s, 5.86 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 5, seg size 7,
151506 inserts, 151506 merged recs, 51417 merges
Hash table size 138401, node heap has 734 buffer(s)
17984.81 hash searches/s, 7185.83 non-hash searches/s
---
LOG
---
Log sequence number 39 826960806
Log flushed up to 39 826960806
Last checkpoint at 39 826852202
0 pending log writes, 0 pending chkp writes
309036 log i/o's done, 5.70 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total memory allocated 124456146; in additional pool allocated 16776448
Dictionary memory allocated 7882184
Buffer pool size 4096
Free buffers 0
Database pages 3362
Modified db pages 69
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages read 9936456, created 39555, written 574800
174.83 reads/s, 0.05 creates/s, 0.81 writes/s
Buffer pool hit rate 998 / 1000
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
1 read views open inside InnoDB
Main thread process no. 2793, id 1187072320, state: sleeping
Number of rows inserted 3185386, updated 3830696, deleted 2270357, read 1852055190
2.86 inserts/s, 1.65 updates/s, 1.62 deletes/s, 34673.63 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================