W
W
webivan12017-01-21 21:58:53
MySQL
webivan1, 2017-01-21 21:58:53

Help! mysql error can anyone help?

Hello!
We reworked one project on yii1, optimized queries and other things.
We rolled out and couldn’t help but rejoice until letters began to arrive that colleagues see 500 errors on the site ...
I don’t understand what’s going on, I go to the page and there’s nothing there, but one “beautiful day” I came across this error, which For some reason, it does not always appear, but very rarely.

Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction

The admin does not want to help us, he says it's all for you to sort out what you wrote (
The only thing I executed from under the root command: SHOW ENGINE INNODB STATUS
The answer was:
| InnoDB |      | 
=====================================
2017-01-20 18:17:30 7ff0a7ec8700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 27 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 3 srv_active, 0 srv_shutdown, 450 srv_idle
srv_master_thread log flush and writes: 453
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 1281
OS WAIT ARRAY INFO: signal count 1333
Mutex spin waits 19051, rounds 2470, OS waits 20
RW-shared spins 1497, rounds 37103, OS waits 1209
RW-excl spins 1108, rounds 3066, OS waits 45
Spin rounds per wait: 0.13 mutex, 24.78 RW-shared, 2.77 RW-excl
------------
TRANSACTIONS
------------
Trx id counter 86502654
Purge done for trx's n:o < 86501657 undo n:o < 0 state: running but idle
History list length 1141
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0, not started
MySQL thread id 30, OS thread handle 0x7ff0a7ec8700, query id 502 localhost root init
SHOW ENGINE INNODB STATUS
--------
FILE I/O
--------
I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
I/O thread 1 state: waiting for completed aio requests (log thread)
I/O thread 2 state: waiting for completed aio requests (read thread)
I/O thread 3 state: waiting for completed aio requests (read thread)
I/O thread 4 state: waiting for completed aio requests (read thread)
I/O thread 5 state: waiting for completed aio requests (read thread)
I/O thread 6 state: waiting for completed aio requests (write thread)
I/O thread 7 state: waiting for completed aio requests (write thread)
I/O thread 8 state: waiting for completed aio requests (write thread)
I/O thread 9 state: waiting for completed aio requests (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
13531 OS file reads, 5 OS file writes, 5 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 7526, seg size 7528, 0 merges
merged operations:
 insert 0, delete mark 0, delete 0
discarded operations:
 insert 0, delete mark 0, delete 0
0.00 hash searches/s, 0.00 non-hash searches/s
---
LOG
---
Log sequence number 1051752548910
Log flushed up to   1051752548910
Pages flushed up to 1051752548910
Last checkpoint at  1051752548910
Max checkpoint age    106117817
Checkpoint age target 102801636
Modified age          0
Checkpoint age        0
0 pending log writes, 0 pending chkp writes
8 log i/o's done, 0.00 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total memory allocated 558891008; in additional pool allocated 0
Total memory allocated by read views 88
Internal hash tables (constant factor + variable factor)
    Adaptive hash index 10215120        (8851048 + 1364072)
    Page hash           553976 (buffer pool 0 only)
    Dictionary cache    2685512         (2214224 + 471288)
    File system         2913952         (812272 + 2101680)
    Lock system         1329536         (1329176 + 360)
    Recovery system     0       (0 + 0)
Dictionary memory allocated 471288
Buffer pool size        32767
Buffer pool size, bytes 536854528
Free buffers            19196
Database pages          13488
Old database pages      4998
Modified db pages       0
Percent of dirty pages(LRU & free pages): 0.000
Max dirty pages percent: 75.000
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 13488, created 0, written 1
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: 13488, 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
0 read views open inside InnoDB
0 RW transactions active inside InnoDB
0 RO transactions active inside InnoDB
0 out of 1000 descriptors used
Main thread process no. 14168, id 140670605977344, state: sleeping
Number of rows inserted 0, updated 0, deleted 0, read 1355759
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
Number of system rows inserted 0, updated 0, deleted 0, read 0
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================

What should I understand from this? Help me figure out what and how, it's not clear which request is buggy or it's the base itself that's kidding.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2017-01-21
@Rsa97

https://habrahabr.ru/post/160485/

O
Optimus, 2017-01-22
Pyan @marrk2

What would it be like to see immediately queries to the database in try / catch with logging, do it right away

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question