File: lob_rollback_deadlock.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 (84 lines) | stat: -rw-r--r-- 2,452 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#
# Bug #30258536 DEADLOCK BETWEEN LOB::ALLOC_LOB_PAGE AND ROW_UNDO_MOD_CLUST_LOW
#
--source include/have_debug_sync.inc
--source include/have_innodb_16k.inc
--source include/count_sessions.inc

# We want the pages released during ROLLBACK
# to be reused by transaction doing INSERT.
# It is easier if they operate on two different
# tables (t1 and t2) as then we don't have to
# worry them being serialized because of accessing
# the index lock.
# On the other hand, pages are reused within a TABLESPACE,
# so we make sure both tables reside in the same one.
CREATE TABLESPACE ts1;

CREATE TABLE t1 (
  id INT PRIMARY KEY,
  make_big CHAR(200),
  val LONGBLOB
) TABLESPACE ts1;
CREATE TABLE t2 (
  id INT PRIMARY KEY,
  make_big CHAR(200),
  val LONGBLOB
) TABLESPACE ts1;

INSERT INTO t1 (id,val) VALUES (1,REPEAT('a',1000000));
INSERT INTO t2 (id,val) VALUES (1,REPEAT('a',1000000));
INSERT INTO t1 (id,val) VALUES (2,REPEAT('a',1000000));
INSERT INTO t2 (id,val) VALUES (2,REPEAT('a',1000000));
INSERT INTO t1 (id,val) VALUES (3,REPEAT('a',1000000));
# Length of the following blob is chosen in such a way, that the
# first page of the LOB which we will allocate by the following UPDATE t2
# will be first page of an extent, and therefore, the rollback of the
# UPDATE will free the extent and make it available for the following
# INSERT INTO t1.
INSERT INTO t2 (id,val) VALUES (3,REPEAT('a',523809));

--connect (con1,localhost,root,,)
--connect (con2,localhost,root,,)

--connection con1
  BEGIN;
  UPDATE t2 SET val = REPEAT('b',10000) WHERE id=3;
  SET DEBUG_SYNC=
    'ib_blob_update_rollback_will_reserve
    SIGNAL con1_will_reserve
    WAIT_FOR con1_can_reserve';
  --send ROLLBACK

--connection default
  SET DEBUG_SYNC='now WAIT_FOR con1_will_reserve';

--connection con2
  BEGIN;
  --send INSERT INTO t1 (id,val) VALUES (4000,REPEAT('b',1000000))

--connection default
# I am sorry about this sleep. What we really wait for is a
# call to buf_page_get_gen with page_no equal to the page
# which was previously freed by the ROLLBACK of UPDATE.
# It's not easy to hard code this, and there are multiple
# calls to buf_page_get_gen() before it happens.
  --sleep 1
  SET DEBUG_SYNC='now SIGNAL con1_can_reserve';

--connection con1
  --reap

--connection con2
  --reap
  ROLLBACK;

--connection default
--disconnect con1
--disconnect con2

DROP TABLE t1;
DROP TABLE t2;
DROP TABLESPACE ts1;

--source include/wait_until_count_sessions.inc