新手刚刚接手数据库相关工作,发现最近数据库好像出现死锁。
以下是用命令:show engine innodb status\G;输出的信息,帮忙看看。mysql> show engine innodb status\G;
*************************** 1. row ***************************
  Type: InnoDB
  Name: 
Status: 
=====================================
2013-04-28 14:23:08 7f44abc20700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 9 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 3793 srv_active, 0 srv_shutdown, 156450 srv_idle
srv_master_thread log flush and writes: 160243
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 786
OS WAIT ARRAY INFO: signal count 859
Mutex spin waits 2498, rounds 10520, OS waits 232
RW-shared spins 647, rounds 16634, OS waits 542
RW-excl spins 138, rounds 1109, OS waits 9
Spin rounds per wait: 4.21 mutex, 25.71 RW-shared, 8.04 RW-excl
------------
TRANSACTIONS
------------
Trx id counter 429726
Purge done for trx's n:o < 429702 undo n:o < 0 state: running but idle
History list length 1492
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0, not started
MySQL thread id 7096, OS thread handle 0x7f44abc20700, query id 557115 10.1.0.160 admin init
show engine innodb status
---TRANSACTION 0, not started
MySQL thread id 5174, OS thread handle 0x7f44a5a67700, query id 557023 10.1.2.165 admin cleaning up
---TRANSACTION 429725, ACTIVE 209 sec
1 lock struct(s), heap size 376, 0 row lock(s)
MySQL thread id 7093, OS thread handle 0x7f44ab916700, query id 557110 10.1.0.160 admin cleaning up
Trx read view will not see trx with id >= 429726, sees < 429685
---TRANSACTION 429722, ACTIVE 355 sec
1 lock struct(s), heap size 376, 0 row lock(s)
MySQL thread id 7090, OS thread handle 0x7f44a51c5700, query id 557075 10.1.0.160 admin cleaning up
Trx read view will not see trx with id >= 429723, sees < 429685
---TRANSACTION 429717, ACTIVE 596 sec
1 lock struct(s), heap size 376, 0 row lock(s)
MySQL thread id 7084, OS thread handle 0x7f44a5247700, query id 557020 10.1.0.160 admin cleaning up
Trx read view will not see trx with id >= 429718, sees < 429685
---TRANSACTION 429712, ACTIVE 655 sec
1 lock struct(s), heap size 376, 0 row lock(s)
MySQL thread id 7079, OS thread handle 0x7f44a544f700, query id 556958 10.1.0.160 admin cleaning up
Trx read view will not see trx with id >= 429713, sees < 429685
---TRANSACTION 429708, ACTIVE 793 sec
1 lock struct(s), heap size 376, 0 row lock(s)
MySQL thread id 7075, OS thread handle 0x7f44a5698700, query id 556905 10.1.0.160 admin cleaning up
Trx read view will not see trx with id >= 429709, sees < 429685
---TRANSACTION 429685, ACTIVE 935 sec
21 lock struct(s), heap size 6960, 5805 row lock(s), undo log entries 1
MySQL thread id 7072, OS thread handle 0x7f44a538c700, query id 556870 10.1.0.160 admin cleaning up
Trx read view will not see trx with id >= 429701, sees < 429698
--------
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
632 OS file reads, 12560 OS file writes, 6729 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 merges
merged operations:
 insert 0, delete  0, delete 0
discarded operations:
 insert 0, delete  0, delete 0
Hash table size 276707, node heap has 3 buffer(s)
0.00 hash searches/s, 0.00 non-hash searches/s
---
LOG
---
Log sequence number 260816616
Log flushed up to   260816616
Pages flushed up to 260816616
Last checkpoint at  260816616
0 pending log writes, 0 pending chkp writes
2764 log i/o's done, 0.00 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total memory allocated 137363456; in additional pool allocated 0
Dictionary memory allocated 166682
Buffer pool size   8192
Free buffers       6490
Database pages     1699
Old database pages 607
Modified db pages  0
Pending reads 0
Pending writes: LRU 0, flush list 0 single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 465, created 1234, written 7586
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 1699, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
6 read views open inside InnoDB
Main thread process no. 2720, id 139932867434240, state: sleeping
Number of rows inserted 379754, updated 506, deleted 85, read 1063967100
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 (0.00 sec)ERROR: 
No query specified

解决方案 »

  1.   

    没发现LATEST DETECTED DEADLOCK这个啊
      

  2.   

    那可能不是死锁?
    有看了下  执行某个操作会有如下的log:
    其中一直在刷类似这样的: I1I1I
    四月 28, 2013 4:20:15 下午 org.hibernate.hql.internal.ast.HqlSqlWalker generatePositionalParameter
    WARN: [DEPRECATION] Encountered positional parameter near line 1, column 68.  Positional parameter are considered deprecated; use named parameters or JPA-style positional parameters instead.
    四月 28, 2013 4:20:15 下午 org.hibernate.hql.internal.ast.HqlSqlWalker generatePositionalParameter
    WARN: [DEPRECATION] Encountered positional parameter near line 1, column 74.  Positional parameter are considered deprecated; use named parameters or JPA-style positional parameters instead.
    四月 28, 2013 4:20:15 下午 org.hibernate.hql.internal.ast.HqlSqlWalker generatePositionalParameter
    WARN: [DEPRECATION] Encountered positional parameter near line 1, column 80.  Positional parameter are considered deprecated; use named parameters or JPA-style positional parameters instead.
    四月 28, 2013 4:20:15 下午 org.hibernate.hql.internal.ast.HqlSqlWalker generatePositionalParameter
    WARN: [DEPRECATION] Encountered positional parameter near line 1, column 84.  Positional parameter are considered deprecated; use named parameters or JPA-style positional parameters instead.
        I1I1I        I1I2I        I1I3I        I1I4I        I1I5I        I1I6I        I1I7I        I1I8I        I1I9I        I1I10I        I1I11I        I1I12I        I1I13I        I1I14I        I1I15I        I1I16I        I1I17I        I1I18I        I1I19I        I3