Mysql innodb 分析定位DeadLock的方法

mysql> show engine innodb status \G
*************************** 1. row ***************************
  Type: InnoDB
  Name:
Status:
=====================================
150228 14:36:02 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 51 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 5895 1_second, 5894 sleeps, 563 10_second, 270 background, 270 flush
srv_master_thread log flush and writes: 5920
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 322, signal count 311
Mutex spin waits 11701, rounds 3692, OS waits 17
RW-shared spins 1543, rounds 19172, OS waits 297
RW-excl spins 2, rounds 197, OS waits 6
Spin rounds per wait: 0.32 mutex, 12.43 RW-shared, 98.50 RW-excl
------------
TRANSACTIONS
------------
Trx id counter 2760906
Purge done for trx's n:o < 2760319 undo n:o < 0
History list length 2069
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0, not started
MySQL thread id 1591, OS thread handle 0x9bae4b40, query id 138667 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 0, not started
MySQL thread id 1590, OS thread handle 0x9bb15b40, query id 138666 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 2760903, not started
MySQL thread id 1579, OS thread handle 0xa37ffb40, query id 141382 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27608FF, not started
MySQL thread id 1578, OS thread handle 0xa316cb40, query id 141374 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27608FD, not started
MySQL thread id 1577, OS thread handle 0xa33ffb40, query id 141370 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 2760900, not started
MySQL thread id 1576, OS thread handle 0xa6a6cb40, query id 141377 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 2760902, not started
MySQL thread id 1575, OS thread handle 0xa45ffb40, query id 141381 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 2760905, not started
MySQL thread id 1574, OS thread handle 0xa456cb40, query id 141386 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 2760904, not started
MySQL thread id 1573, OS thread handle 0x9f0ffb40, query id 141384 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 2760901, not started
MySQL thread id 1571, OS thread handle 0xa3c3bb40, query id 141379 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27608FE, not started
MySQL thread id 1572, OS thread handle 0xa406cb40, query id 141372 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 0, not started
MySQL thread id 1562, OS thread handle 0x9f26cb40, query id 138186 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 0, not started
MySQL thread id 1550, OS thread handle 0x9be6cb40, query id 128598 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 0, not started
MySQL thread id 1549, OS thread handle 0xa6aceb40, query id 128597 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27608FA, not started
MySQL thread id 1540, OS thread handle 0x9f33bb40, query id 141362 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27608F9, not started
MySQL thread id 1539, OS thread handle 0x9f36cb40, query id 141359 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27608F8, not started
MySQL thread id 1538, OS thread handle 0x9f39db40, query id 141358 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27608F5, not started
MySQL thread id 1535, OS thread handle 0x9f3ffb40, query id 141351 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27608F4, not started
MySQL thread id 1534, OS thread handle 0xa3c6cb40, query id 141349 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27608F3, not started
MySQL thread id 1533, OS thread handle 0xa459db40, query id 141347 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27608FB, not started
MySQL thread id 1532, OS thread handle 0xa379db40, query id 141363 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27608F2, not started
MySQL thread id 1530, OS thread handle 0xa6a3bb40, query id 141345 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27608F7, not started
MySQL thread id 1529, OS thread handle 0xa6a0ab40, query id 141355 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27608F6, not started
MySQL thread id 1528, OS thread handle 0xa6a9db40, query id 141354 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 0, not started
MySQL thread id 1519, OS thread handle 0xa31ceb40, query id 128244 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27605F0, not started
MySQL thread id 1478, OS thread handle 0xa3c9db40, query id 139797 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27605EF, not started
MySQL thread id 1477, OS thread handle 0xa45ceb40, query id 139795 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27605ED, not started
MySQL thread id 1476, OS thread handle 0xa399db40, query id 139791 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27605EE, not started
MySQL thread id 1475, OS thread handle 0x9f23bb40, query id 139793 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27605EC, not started
MySQL thread id 1474, OS thread handle 0x9f2ffb40, query id 139789 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27605F3, not started
MySQL thread id 1473, OS thread handle 0xa403bb40, query id 139803 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27605F1, not started
MySQL thread id 1479, OS thread handle 0xa373bb40, query id 139799 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 27605F2, not started
MySQL thread id 1472, OS thread handle 0xa6c6db40, query id 139801 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 0, not started
MySQL thread id 1142, OS thread handle 0xa376cb40, query id 141387 localhost vobile
show engine innodb status
---TRANSACTION 27608AB, not started
MySQL thread id 1140, OS thread handle 0xa6c9eb40, query id 141203 vobile-To-be-filled-by-O-E-M.local 192.168.5.74 root
---TRANSACTION 2755281, not started
MySQL thread id 992, OS thread handle 0xa453bb40, query id 58433 ubuntu.local 192.168.5.73 root
--------
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 (read thread)
I/O thread 4 state: waiting for i/o request (read thread)
I/O thread 5 state: waiting for i/o request (read thread)
I/O thread 6 state: waiting for i/o request (write thread)
I/O thread 7 state: waiting for i/o request (write thread)
I/O thread 8 state: waiting for i/o request (write thread)
I/O thread 9 state: waiting for i/o request (write thread)
Pending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 0 [0, 0, 0, 0] ,
 ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0
Pending flushes (fsync) log: 0; buffer pool: 0
35216 OS file reads, 3101 OS file writes, 2163 OS fsyncs
0.69 reads/s, 16384 avg bytes/read, 0.31 writes/s, 0.31 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 5, seg size 7, 30 merges
merged operations:
 insert 157, delete mark 7, delete 0
discarded operations:
 insert 0, delete mark 0, delete 0
Hash table size 553253, node heap has 7 buffer(s)
666.48 hash searches/s, 30.12 non-hash searches/s
---
LOG
---
Log sequence number 15892236502
Log flushed up to   15892236492
Last checkpoint at  15892236492
0 pending log writes, 0 pending chkp writes
1635 log i/o's done, 0.16 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total memory allocated 135987200; in additional pool allocated 0
Dictionary memory allocated 20949767
Buffer pool size   8192
Free buffers       0
Database pages     8185
Old database pages 3001
Modified db pages  1
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 27491, not young 0
0.69 youngs/s, 0.00 non-youngs/s
Pages read 37064, created 165, written 1857
0.69 reads/s, 0.00 creates/s, 0.08 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 8185, unzip_LRU len: 0
I/O sum[39]:cur[0], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
1 read views open inside InnoDB
Main thread process no. 1085, id 2792565568, state: sleeping
Number of rows inserted 1089, updated 668, deleted 5, read 2488907
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 766.16 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT

============================


看你的mysql現在已提供什麼存儲引擎:
mysql> show engines;

看你的mysql當前默認的存儲引擎:
mysql> show variables like '%storage_engine%';

你要看某個表用了什麼引擎(在顯示結果裏參數engine後面的就表示該表當前用的存儲引擎):
mysql> show create table 表名;


其他可以參考的資料:
http://blog.chinaunix.net/uid-9950859-id-181376.html

http://www.aichengxu.com/view/24054



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章