File: deadlock_in_subquery.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (61 lines) | stat: -rw-r--r-- 1,353 bytes parent folder | download
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
#
# Bug #34616560 -- assert failure after deadlock detection
#

--source include/have_debug_sync.inc

CREATE TABLE t1 (
  column1 int NOT NULL
);

INSERT INTO t1 VALUES (80);


CREATE TABLE t2 (
  column1 int DEFAULT NULL,
  column2 double DEFAULT NULL,
  column3 text,
  column4 double DEFAULT NULL
);

INSERT INTO t2 VALUES
(77,76.1,'abc',NULL),
(81,NULL,'abcd',86.71),
(83,95.58,'abcde',67.74);

CREATE TABLE t3 (
  column1 int DEFAULT NULL,
  x text
);

INSERT INTO t3 VALUES
(76,''),
(82,'');

--connect(c0,localhost,root,,)
--connect(c1,localhost,root,,)

--connection c1
  START TRANSACTION;
  update t2 set column1 = 125;

--connection c0
  START TRANSACTION;
  SET DEBUG_SYNC = 'lock_wait_will_wait SIGNAL c0_will_wait';
  --send update t3 set x = case when exists ( select ref_2.column2 as c0 from t2 as ref_2 window w_cc03ob as ( partition by ref_2.column3 order by ref_2.column4 desc)) then null else 24 end where exists (select distinct * from t1);

--connection c1
  SET DEBUG_SYNC = 'now WAIT_FOR c0_will_wait';
  update t2 set column1 = 122;
  update t3 set column1 = 123;
  commit;

# We expect a deadlock between the update on c0 and the other update to t2 on c1,
#  and we expect the deadlock detector to kill c0, and let c1 run.
--connection c0
  --error ER_LOCK_DEADLOCK
  --reap

  drop table t1;
  drop table t2;
  drop table t3;