powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / MySQL [игнор отключен] [закрыт для гостей] / Getting Deadlock error on delete statement
5 сообщений из 5, страница 1 из 1
Getting Deadlock error on delete statement
    #38619651
Shahriyar.R
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Dear experts,

From debug script i am getting Deadlock detected error every 5 or 10 minutes continously:

Код: php
1.
2.
3.
4.
5.
2014/04/19 22:18:24 [error] [system.db.CDbCommand] Не удалось
выполнить CDbCommand::execute(): SQLSTATE[40001]:
Serialization failure: 1213 Deadlock found when trying to get lock;
try restarting transaction. Выполнявшийся
SQL-запрос: DELETE FROM `online` WHERE `time` < 1397927664.



Need help, solving this issue or workaround to this problem.
Below i will provide all necessary related information:

MySQL version:

Код: sql
1.
2.
3.
4.
5.
6.
7.
mysql> select @@version;
+------------+
| @@version  |
+------------+
| 5.6.10-log |
+------------+
1 row in set (0,00 sec)



MySQL server is installed on Centos 6.3.

From engine status:

Код: powershell
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
215.
216.
217.
218.
219.
220.
221.
222.
223.
224.
225.
226.
227.
228.
229.
230.
231.
232.
233.
234.
235.
236.
237.
238.
239.
240.
241.
242.
243.
244.
245.
246.
247.
248.
249.
250.
251.
252.
253.
254.
255.
256.
257.
258.
259.
260.
261.
262.
263.
264.
265.
266.
267.
268.
269.
270.
271.
272.
273.
274.
275.
276.
277.
278.
279.
280.
281.
282.
283.
284.
285.
286.
287.
288.
289.
290.
291.
292.
293.
294.
295.
296.
297.
298.
299.
300.
301.
302.
303.
304.
305.
306.
307.
308.
309.
310.
311.
312.
313.
314.
315.
316.
317.
318.
319.
320.
321.
322.
323.
324.
325.
326.
327.
328.
329.
330.
331.
332.
333.
334.
335.
336.
337.
338.
339.
340.
341.
342.
343.
344.
345.
346.
347.
348.
349.
350.
351.
352.
353.
354.
355.
356.
357.
358.
359.
360.
361.
362.
363.
364.
365.
366.
367.
368.
369.
370.
371.
372.
373.
374.
375.
376.
377.
378.
379.
380.
381.
382.
383.
384.
385.
386.
387.
388.
389.
390.
391.
392.
393.
394.
395.
396.
397.
398.
399.
400.
401.
402.
403.
404.
405.
406.
407.
408.
409.
410.
411.
412.
413.
414.
415.
416.
417.
418.
419.
420.
421.
422.
423.
424.
425.
426.
427.
428.
429.
430.
431.
432.
433.
434.
435.
436.
437.
438.
439.
440.
441.
442.
443.
444.
445.
446.
447.
448.
449.
450.
451.
452.
453.
454.
455.
456.
457.
458.
459.
460.
461.
462.
463.
464.
465.
466.
467.
468.
469.
470.
471.
472.
473.
474.
475.
476.
477.
478.
479.
480.
481.
482.
483.
484.
485.
486.
487.
488.
489.
490.
491.
492.
493.
494.
495.
496.
497.
498.
499.
500.
501.
502.
503.
504.
505.
506.
507.
508.
509.
510.
511.
512.
513.
514.
515.
516.
517.
518.
519.
520.
521.
522.
523.
524.
525.
526.
527.
528.
529.
530.
531.
532.
533.
534.
535.
536.
537.
538.
539.
540.
541.
542.
543.
544.
545.
546.
547.
548.
549.
550.
551.
552.
553.
554.
555.
556.
557.
558.
559.
560.
561.
562.
563.
564.
565.
566.
567.
568.
569.
570.
571.
572.
573.
574.
575.
576.
577.
578.
579.
580.
------------------------
LATEST DETECTED DEADLOCK
------------------------
2014-04-19 22:25:44 7f4f74579700
*** (1) TRANSACTION:
TRANSACTION 6872158026, ACTIVE 0 sec starting index read
mysql tables in use 1, locked 1
LOCK WAIT 3 lock struct(s), heap size 1248, 2 row lock(s)
MySQL thread id 41331272, OS thread handle 0x7f4bfbf89700, query id 817240587 85.132.52.203 vesti_user updating
DELETE FROM `online` WHERE `time` < 1397929000
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 966 page no 6 n bits 328 index `PRIMARY` of table `vesti_db`.`online` trx id 6872158026 lock_mode X locks rec but not gap waiting
Record lock, heap no 166 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56e9d; asc   n ;;
 1: len 6; hex 0001999ccf49; asc      I;;
 2: len 7; hex 220000c027158c; asc "   '  ;;
 3: len 30; hex 326465393833373439363336636534366331346439316666333464303837; asc 2de983749636ce46c14d91ff34d087; (total 32 bytes);
 4: len 8; hex 800000005352b428; asc     SR (;;

*** (2) TRANSACTION:
TRANSACTION 6872158025, ACTIVE 0 sec updating or deleting
mysql tables in use 1, locked 1
10 lock struct(s), heap size 3112, 1687 row lock(s), undo log entries 1
MySQL thread id 41331271, OS thread handle 0x7f4f74579700, query id 817240586 85.132.52.203 vesti_user updating
UPDATE `online` SET `session`='2de983749636ce46c14d91ff34d087b9'
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 966 page no 6 n bits 328 index `PRIMARY` of table `vesti_db`.`online` trx id 6872158025 lock_mode X
Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0
 0: len 8; hex 73757072656d756d; asc supremum;;

Record lock, heap no 166 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56e9d; asc   n ;;
 1: len 6; hex 0001999ccf49; asc      I;;
 2: len 7; hex 220000c027158c; asc "   '  ;;
 3: len 30; hex 326465393833373439363336636534366331346439316666333464303837; asc 2de983749636ce46c14d91ff34d087; (total 32 bytes);
 4: len 8; hex 800000005352b428; asc     SR (;;

Record lock, heap no 167 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56e9e; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080111cc3; asc u      ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b428; asc     SR (;;

Record lock, heap no 168 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56e9f; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080111d35; asc u     5;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b428; asc     SR (;;

Record lock, heap no 169 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ea0; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080111da7; asc u      ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b428; asc     SR (;;

Record lock, heap no 170 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ea1; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080111e19; asc u      ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b428; asc     SR (;;

Record lock, heap no 171 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ea2; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080111e8b; asc u      ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b428; asc     SR (;;

Record lock, heap no 172 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ea3; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080111efd; asc u      ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b428; asc     SR (;;

Record lock, heap no 173 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ea4; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080111f6f; asc u     o;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b428; asc     SR (;;

Record lock, heap no 174 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ea5; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080111fe1; asc u      ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b428; asc     SR (;;

Record lock, heap no 175 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ea6; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112053; asc u     S;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b428; asc     SR (;;

Record lock, heap no 176 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ea7; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 750000801120c5; asc u      ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b429; asc     SR );;

Record lock, heap no 177 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ea8; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112137; asc u    !7;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b429; asc     SR );;

Record lock, heap no 178 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ea9; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 750000801121a9; asc u    ! ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b429; asc     SR );;

Record lock, heap no 179 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eaa; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 7500008011221b; asc u    " ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b429; asc     SR );;

Record lock, heap no 180 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eab; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 7500008011228d; asc u    " ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b429; asc     SR );;

Record lock, heap no 181 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eac; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 750000801122ff; asc u    " ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b429; asc     SR );;

Record lock, heap no 182 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ead; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112371; asc u    #q;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b429; asc     SR );;

Record lock, heap no 183 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eae; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 750000801123e3; asc u    # ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b429; asc     SR );;

Record lock, heap no 184 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eaf; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112455; asc u    $U;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42a; asc     SR *;;

Record lock, heap no 185 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eb0; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 750000801124c7; asc u    $ ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42a; asc     SR *;;

Record lock, heap no 186 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eb1; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112539; asc u    %9;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42a; asc     SR *;;

Record lock, heap no 187 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eb2; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 750000801125ab; asc u    % ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42a; asc     SR *;;

Record lock, heap no 188 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eb3; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 7500008011261d; asc u    & ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42a; asc     SR *;;

Record lock, heap no 189 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eb4; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 7500008011268f; asc u    & ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42a; asc     SR *;;

Record lock, heap no 190 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eb5; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112701; asc u    ' ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42a; asc     SR *;;

Record lock, heap no 191 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eb6; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112773; asc u    's;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42a; asc     SR *;;

Record lock, heap no 192 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eb7; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 750000801127e5; asc u    ' ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42b; asc     SR +;;

Record lock, heap no 193 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eb8; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112857; asc u    (W;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42b; asc     SR +;;

Record lock, heap no 194 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eb9; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 750000801128c9; asc u    ( ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42b; asc     SR +;;

Record lock, heap no 195 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eba; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 7500008011293b; asc u    );;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42b; asc     SR +;;

Record lock, heap no 196 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ebb; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 750000801129ad; asc u    ) ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42b; asc     SR +;;

Record lock, heap no 197 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ebc; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112a1f; asc u    * ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42b; asc     SR +;;

Record lock, heap no 198 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ebd; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112a91; asc u    * ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42b; asc     SR +;;

Record lock, heap no 199 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ebe; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112b03; asc u    + ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42c; asc     SR ,;;

Record lock, heap no 200 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ebf; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112b75; asc u    +u;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42c; asc     SR ,;;

Record lock, heap no 201 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ec0; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112be7; asc u    + ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42c; asc     SR ,;;

Record lock, heap no 202 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ec1; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112c59; asc u    ,Y;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42c; asc     SR ,;;

Record lock, heap no 203 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ec2; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112ccb; asc u    , ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42c; asc     SR ,;;

Record lock, heap no 204 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ec3; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112d3d; asc u    -=;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42c; asc     SR ,;;

Record lock, heap no 205 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ec4; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112daf; asc u    - ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42c; asc     SR ,;;

Record lock, heap no 206 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ec5; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112e21; asc u    .!;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42c; asc     SR ,;;

Record lock, heap no 207 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ec6; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112e93; asc u    . ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42c; asc     SR ,;;

Record lock, heap no 208 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ec7; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112f05; asc u    / ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42c; asc     SR ,;;

Record lock, heap no 209 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ec8; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112f77; asc u    /w;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42c; asc     SR ,;;

Record lock, heap no 210 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ec9; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080112fe9; asc u    / ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42c; asc     SR ,;;

Record lock, heap no 211 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eca; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 7500008011305b; asc u    0[;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42c; asc     SR ,;;

Record lock, heap no 212 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ecb; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 750000801130cd; asc u    0 ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42d; asc     SR -;;

Record lock, heap no 213 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ecc; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 7500008011313f; asc u    1?;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42d; asc     SR -;;

Record lock, heap no 214 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ecd; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 750000801131b1; asc u    1 ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42d; asc     SR -;;

Record lock, heap no 215 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ece; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080113223; asc u    2#;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42d; asc     SR -;;

Record lock, heap no 216 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ecf; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080113295; asc u    2 ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42d; asc     SR -;;

Record lock, heap no 217 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ed0; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080113307; asc u    3 ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42d; asc     SR -;;

Record lock, heap no 218 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ed1; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080113379; asc u    3y;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42d; asc     SR -;;

Record lock, heap no 219 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ed2; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 750000801133eb; asc u    3 ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42d; asc     SR -;;

Record lock, heap no 220 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ed3; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 7500008011345d; asc u    4];;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42d; asc     SR -;;

Record lock, heap no 221 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ed4; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 750000801134cf; asc u    4 ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42d; asc     SR -;;

Record lock, heap no 222 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ed5; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080113541; asc u    5A;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42d; asc     SR -;;

Record lock, heap no 223 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ed6; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 750000801135b3; asc u    5 ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42e; asc     SR .;;

Record lock, heap no 224 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ed7; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080113625; asc u    6%;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42e; asc     SR .;;

Record lock, heap no 225 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ed8; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080113697; asc u    6 ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42e; asc     SR .;;

Record lock, heap no 226 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ed9; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080113709; asc u    7 ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42e; asc     SR .;;

Record lock, heap no 227 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56eda; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 7500008011377b; asc u    7{;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42e; asc     SR .;;

Record lock, heap no 228 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56edb; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 750000801137ed; asc u    7 ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42f; asc     SR /;;

Record lock, heap no 229 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56edc; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 7500008011385f; asc u    8_;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42f; asc     SR /;;

Record lock, heap no 230 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56edd; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 750000801138d1; asc u    8 ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42f; asc     SR /;;

Record lock, heap no 231 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ede; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080113943; asc u    9C;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b42f; asc     SR /;;

Record lock, heap no 232 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56edf; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 750000801139b5; asc u    9 ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b430; asc     SR 0;;

Record lock, heap no 233 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ee0; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080113a27; asc u    :';;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b430; asc     SR 0;;

Record lock, heap no 234 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ee1; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080113a99; asc u    : ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b430; asc     SR 0;;

Record lock, heap no 235 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ee2; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080113b0b; asc u    ; ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b430; asc     SR 0;;

Record lock, heap no 236 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ee3; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080113b7d; asc u    ;};;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b431; asc     SR 1;;

Record lock, heap no 237 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ee4; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080113bef; asc u    ; ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b431; asc     SR 1;;

Record lock, heap no 238 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ee5; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080113c61; asc u    <a;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b431; asc     SR 1;;

Record lock, heap no 239 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ee6; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080113cd3; asc u    < ;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b431; asc     SR 1;;

Record lock, heap no 240 PHYSICAL RECORD: n_fields 5; compact format; info bits 0
 0: len 4; hex 89e56ee7; asc   n ;;
 1: len 6; hex 0001999cc623; asc      #;;
 2: len 7; hex 75000080113d45; asc u    =E;;
 3: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 4: len 8; hex 800000005352b431; asc     SR 1;;

*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 966 page no 138 n bits 392 index `time` of table `vesti_db`.`online` trx id 6872158025 lock_mode X locks rec but not gap waiting
Record lock, heap no 225 PHYSICAL RECORD: n_fields 3; compact format; info bits 0
 0: len 8; hex 800000005352b428; asc     SR (;;
 1: len 30; hex 373663666266353363346334623432396230653939323837646166366435; asc 76cfbf53c4c4b429b0e99287daf6d5; (total 32 bytes);
 2: len 4; hex 89e56e9d; asc   n ;;

*** WE ROLL BACK TRANSACTION (1)
------------
TRANSACTIONS
------------
Trx id counter 6872237824
Purge done for trx's n:o < 6872236912 undo n:o < 0 state: running but idle
History list length 827
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 6872237821, not started
MySQL thread id 41337101, OS thread handle 0x7f4f740a6700, query id 817353101 85.132.89.228 lent_user cleaning up
---TRANSACTION 0, not started
MySQL thread id 41313466, OS thread handle 0x7f4bfc0ce700, query id 817353106 localhost root init
show engine innodb status
---TRANSACTION 6872237823, ACTIVE 0 sec starting index read
mysql tables in use 1, locked 1
8 lock struct(s), heap size 1248, 1296 row lock(s), undo log entries 351
MySQL thread id 41337099, OS thread handle 0x7f4bfe7a7700, query id 817353105 85.132.89.228 lent_user updating
UPDATE `online` SET `session`='959c74fec9e551e0e82d170ddf064904'




Table Structure:


Код: sql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
mysql> show create table online;
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table  | Create Table                                                                                                                                                                                                                                         |
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| online | CREATE TABLE `online` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `session` varchar(150) NOT NULL,
  `time` bigint(20) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `time` (`time`,`session`)
) ENGINE=InnoDB AUTO_INCREMENT=166031412 DEFAULT CHARSET=utf8 |
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0,00 sec)



SQL statements executed on this table are:

Код: sql
1.
2.
3.
4.
5.
INSERT INTO `online` (`session`, `time`) VALUES ('d2cc24a6cae9bc0728fb614ff1672f32', '1397922431')

DELETE FROM `online` WHERE `time` < 1397921312

UPDATE `online` SET `session`='855b9cc5c0f87076c80105c4de371d00'




Explain plans:

Код: sql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
mysql> explain DELETE FROM `online` WHERE `time` < 1397921312\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: online
         type: range
possible_keys: PRIMARY,time
          key: time
      key_len: 8
          ref: NULL
         rows: 1
        Extra: Using where
1 row in set (0,00 sec)

mysql> explain UPDATE `online` SET `session`='855b9cc5c0f87076c80105c4de371d00'\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: online
         type: index
possible_keys: PRIMARY,time
          key: PRIMARY
      key_len: 4
          ref: NULL
         rows: 1694
        Extra: Using temporary
1 row in set (0,00 sec)




Thanks.
...
Рейтинг: 0 / 0
Getting Deadlock error on delete statement
    #38619751
Shahriyar.R
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Dear All i tried to reproduce this deadlock condition in my Virtual Test Environment and it was successfully reproduced.

So , the reason for this deadlock is updating all table several times in transaction while delete statement is in process.
Exactly, run update several times:

Код: sql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
mysql> start transaction;
Query OK, 0 rows affected (0,00 sec)

mysql> UPDATE `online` SET `session`='a4813bb4c1131ae1f4a59434925f6816';
Query OK, 764 rows affected (0,08 sec)
Rows matched: 764  Changed: 764  Warnings: 0

mysql> UPDATE `online` SET `session`='a4813bb4c1131ae1f4a59434925f6816';
Query OK, 0 rows affected (0,00 sec)
Rows matched: 764  Changed: 0  Warnings: 0

mysql> UPDATE `online` SET `session`='a4813bb4c1131ae1f4a59434925f6817';
Query OK, 764 rows affected (0,04 sec)
Rows matched: 764  Changed: 764  Warnings: 0



After this run delete statement:
Код: sql
1.
2.
3.
4.
5.
mysql> start transaction;
Query OK, 0 rows affected (0,00 sec)

mysql> DELETE FROM `online` WHERE `time` < 1397940676;
ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction




For examining the problem deeply i enabled innodb_print_all_deadlocks:

Код: sql
1.
2.
mysql> set global innodb_print_all_deadlocks=ON;
Query OK, 0 rows affected (0,00 sec)



After replay procedures that i stated above and now i have a more valuable debug information in error log:

Код: sql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
2014-04-20 11:57:35 7f4e2c84a700InnoDB: transactions deadlock detected, dumping detailed information.
2014-04-20 11:57:35 7f4e2c84a700
*** (1) TRANSACTION:
TRANSACTION 8628, ACTIVE 15 sec starting index read
mysql tables in use 1, locked 1
LOCK WAIT 2 lock struct(s), heap size 376, 1 row lock(s)
MySQL thread id 2, OS thread handle 0x7f4e2c809700, query id 110 localhost root updating
DELETE FROM `online` WHERE `time` < 1397940676
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 9 page no 10 n bits 392 index `time` of table `world`.`online` trx id 8628 lock_mode X waiting
Record lock, heap no 131 PHYSICAL RECORD: n_fields 3; compact format; info bits 32
 0: len 8; hex 800000005352fdcf; asc     SR  ;;
 1: len 30; hex 613438313362623463313133316165316634613539343334393235663638; asc a4813bb4c1131ae1f4a59434925f68; (total 32 bytes);
 2: len 4; hex 89e6dc8b; asc     ;;

*** (2) TRANSACTION:
TRANSACTION 8600, ACTIVE 17 sec updating or deleting
mysql tables in use 1, locked 1
7 lock struct(s), heap size 1248, 770 row lock(s), undo log entries 3057
MySQL thread id 1, OS thread handle 0x7f4e2c84a700, query id 120 localhost root updating
UPDATE `online` SET `session`='a4813bb4c1131ae1f4a59434925f68'
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 9 page no 10 n bits 392 index `time` of table `world`.`online` trx id 8600 lock_mode X locks rec but not gap
Record lock, heap no 131 PHYSICAL RECORD: n_fields 3; compact format; info bits 32
 0: len 8; hex 800000005352fdcf; asc     SR  ;;
 1: len 30; hex 613438313362623463313133316165316634613539343334393235663638; asc a4813bb4c1131ae1f4a59434925f68; (total 32 bytes);
 2: len 4; hex 89e6dc8b; asc     ;;

*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 9 page no 10 n bits 392 index `time` of table `world`.`online` trx id 8600 lock_mode X locks gap before rec insert intention waiting
Record lock, heap no 131 PHYSICAL RECORD: n_fields 3; compact format; info bits 32
 0: len 8; hex 800000005352fdcf; asc     SR  ;;
 1: len 30; hex 613438313362623463313133316165316634613539343334393235663638; asc a4813bb4c1131ae1f4a59434925f68; (total 32 bytes);
 2: len 4; hex 89e6dc8b; asc     ;;




*** WE ROLL BACK TRANSACTION (1)



So from this output we can see that TRANSACTION(2):
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 9 page no 10 n bits 392 index `time` of table `world`.`online` trx id 8600 lock_mode X locks rec but not gap

So it does not use gap locking as i understand.
But another information saying that it is in fact used gap locking? :)

*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 9 page no 10 n bits 392 index `time` of table `world`.`online` trx id 8600 lock_mode X locks gap before rec insert intention waiting

Any further explanation from your side will really appreciated.
...
Рейтинг: 0 / 0
Getting Deadlock error on delete statement
    #38620187
Shahriyar.R
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Also reported as BUG due to unclear locking messages in deadlock condition:

http://bugs.mysql.com/bug.php?id=72407
...
Рейтинг: 0 / 0
Getting Deadlock error on delete statement
    #38621014
tanglir
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
А я не понимаю, как
Код: sql
1.
2.
*** (2) TRANSACTION:
TRANSACTION 8600, ACTIVE 17 sec updating or deleting

при том, что самый длительный апдейт продолжался 0,08 секунд.
...
Рейтинг: 0 / 0
Getting Deadlock error on delete statement
    #38621163
Shahriyar.R
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
tanglir,

Really interesting ))

For Transaction 1:

*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
lock_mode X waiting Record lock

For Transaction 2:

*** (2) HOLDS THE LOCK(S):
lock_mode X locks rec but not gap Record lock

*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
lock_mode X locks gap before rec insert intention waiting Record lock

As i search:

"lock_mode X locks gap before rec insert intention waiting Record lock" -- is happening while executing insert statements but i did not run any insert statement :)
And as deadlock monitor stated, The Transaction 1 is DELETE,
Transaction 2 is UPDATE.

Still waiting for an explanation in BUG report from official persons.
...
Рейтинг: 0 / 0
5 сообщений из 5, страница 1 из 1
Форумы / MySQL [игнор отключен] [закрыт для гостей] / Getting Deadlock error on delete statement
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]