Debian Codegraph @

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

raw
1 --source include/have_innodb.inc
2 --source include/count_sessions.inc
3
4 CREATE TABLE t (
5 `a` INT NOT NULL,
6 PRIMARY KEY (`a`)
7 ) ENGINE=InnoDB;
8
9
10 INSERT INTO t VALUES(10);
11 INSERT INTO t VALUES(20);
12
13 SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
14 XA START '1';
15 SELECT * FROM t WHERE a > 20 FOR UPDATE;
16 # The following INSERT is necessary because trx_prepare() resets locks
17 # only if there were modifications in transaction.
18 INSERT INTO t VALUES(40);
19 XA END '1';
20 XA PREPARE '1';
21
22 connect (con1,localhost,root);
23 SET innodb_lock_wait_timeout=1;
24 # The following INSERT must not be blocked if XA PREPARE released supremum lock
25 INSERT INTO t VALUES(50);
26
27 --connection default
28 XA COMMIT '1';
29
30 XA START '1';
31 SELECT * FROM t WHERE a > 20 LOCK IN SHARE MODE;
32 # The following INSERT is necessary because trx_prepare() resets locks
33 # only if there were modifications in transaction.
34 INSERT INTO t VALUES (5);
35 XA END '1';
36 XA PREPARE '1';
37
38 --connection con1
39 # The following INSERT must not be blocked if XA PREPARE released supremum lock
40 INSERT INTO t VALUES (60);
41 # The following INSERT must not be blocked if XA PREPARE released shared lock
42 INSERT INTO t VALUES (30);
43 --disconnect con1
44
45 --connection default
46 XA COMMIT '1';
47 DROP TABLE t;
48 --source include/wait_until_count_sessions.inc