Debian Codegraph @

mysql-test/suite/innodb/t/xa_prepare_unlock_unmodified.test

raw
1 --source include/have_innodb.inc
2 --source include/count_sessions.inc
3 --source include/have_debug.inc
4 --source include/have_sequence.inc
5
6 SET @old_innodb_enable_xap_unlock_unmodified_for_primary_debug=
7 @@GLOBAL.innodb_enable_xap_unlock_unmodified_for_primary_debug;
8 SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug= 1;
9
10 # Make sure there is no dynamic memory allocation during getting offsets for
11 # 32 columns of secondary index with 32 columns of primary index in
12 # lock_rec_unlock_unmodified().
13 DELIMITER $$;
14 BEGIN NOT ATOMIC
15 DECLARE c TEXT DEFAULT(
16 SELECT CONCAT(
17 'CREATE TABLE t1(pk',
18 GROUP_CONCAT(seq SEPARATOR ' INT, pk'), ' INT, a',
19 GROUP_CONCAT(seq SEPARATOR ' INT, a'), ' INT, b',
20 GROUP_CONCAT(seq SEPARATOR ' INT, b'), ' INT, c INT, PRIMARY KEY(pk',
21 GROUP_CONCAT(seq SEPARATOR ', pk'), '), INDEX i1(a',
22 GROUP_CONCAT(seq SEPARATOR ', a'), '), INDEX i2(b',
23 GROUP_CONCAT(seq SEPARATOR ', b'), ')) ENGINE=InnoDB;')
24 FROM seq_1_to_32);
25 EXECUTE IMMEDIATE c;
26 END;
27 $$
28 BEGIN NOT ATOMIC
29 DECLARE c TEXT DEFAULT(
30 SELECT CONCAT(
31 'INSERT INTO t1 VALUES (',
32 GROUP_CONCAT('1' SEPARATOR ','), ',',
33 GROUP_CONCAT('1' SEPARATOR ','), ',',
34 GROUP_CONCAT('1' SEPARATOR ','), ',0), (',
35
36 GROUP_CONCAT('2' SEPARATOR ','), ',',
37 GROUP_CONCAT('1' SEPARATOR ','), ',',
38 GROUP_CONCAT('2' SEPARATOR ','), ',0), (',
39
40 GROUP_CONCAT('3' SEPARATOR ','), ',',
41 GROUP_CONCAT('2' SEPARATOR ','), ',',
42 GROUP_CONCAT('1' SEPARATOR ','), ',0), (',
43
44 GROUP_CONCAT('4' SEPARATOR ','), ',',
45 GROUP_CONCAT('2' SEPARATOR ','), ',',
46 GROUP_CONCAT('2' SEPARATOR ','), ',0);')
47 FROM seq_1_to_32);
48 EXECUTE IMMEDIATE c;
49 END;
50 $$
51 DELIMITER ;$$
52
53 SET @old_timeout= @@GLOBAL.innodb_lock_wait_timeout;
54 SET GLOBAL innodb_lock_wait_timeout= 1;
55
56 XA START "t1";
57 UPDATE t1 FORCE INDEX (i2) SET c=c+1 WHERE a1=1 AND b1=1;
58 XA END "t1";
59 # If there is dynamic memory allocation during getting offsets for
60 # 32 columns of secondary index with 32 columns of primary index in
61 # lock_rec_unlock_unmodified(), the following statement will cause assertion
62 # failure in debug build.
63 XA PREPARE "t1";
64
65 --connect(con1,localhost,root,,)
66 # (pk, 2, 1, 0) record is X-locked but not modified in clustered index with the
67 # above XA transaction, if the bug is not fixed, the following SELECT will be
68 # blocked by the XA transaction if XA PREPARE does not release the unmodified
69 # record.
70 SELECT a1, b1, c FROM t1 FORCE INDEX (i1) WHERE a1=2 AND b1=1 FOR UPDATE;
71 --disconnect con1
72
73 --connection default
74 XA COMMIT "t1";
75
76 SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug=
77 @old_innodb_enable_xap_unlock_unmodified_for_primary_debug;
78
79 SET GLOBAL innodb_lock_wait_timeout= @old_timeout;
80
81 # Check that we can't create secondary index with more than 32 columns.
82 DELIMITER $$;
83 --error ER_TOO_MANY_KEY_PARTS
84 BEGIN NOT ATOMIC
85 DECLARE c TEXT DEFAULT(
86 SELECT CONCAT(
87 'ALTER TABLE t1 ADD COLUMN d',
88 GROUP_CONCAT(seq SEPARATOR ' INT, ADD COLUMN d'),
89 ' INT, ADD INDEX i3(d',
90 GROUP_CONCAT(seq SEPARATOR ', d'), ');')
91 FROM seq_1_to_33);
92 EXECUTE IMMEDIATE c;
93 END;
94 $$
95 DELIMITER ;$$
96
97 DROP TABLE t1;
98 --source include/wait_until_count_sessions.inc