File tree Expand file tree Collapse file tree 3 files changed +27
-6
lines changed Expand file tree Collapse file tree 3 files changed +27
-6
lines changed Original file line number Diff line number Diff line change 1
- CREATE TABLE t1 (a INT) ENGINE=InnoDB;
1
+ CREATE TABLE t1 (a INT PRIMARY KEY ) ENGINE=InnoDB;
2
2
INSERT INTO t1 VALUES (1);
3
3
connect con1,localhost,root;
4
4
XA START 'x';
5
5
UPDATE t1 set a=2;
6
6
XA END 'x';
7
7
XA PREPARE 'x';
8
8
connect con2,localhost,root;
9
- CREATE TABLE t2 (a INT) ENGINE=InnoDB;
9
+ CREATE TABLE t2 (a INT PRIMARY KEY ) ENGINE=InnoDB;
10
10
XA START 'y';
11
11
INSERT INTO t2 VALUES (1);
12
12
XA END 'y';
@@ -29,7 +29,18 @@ XA ROLLBACK 'x';
29
29
SELECT * FROM t1;
30
30
a
31
31
1
32
- DROP TABLE t1;
32
+ CREATE TABLE t3(a INT PRIMARY KEY REFERENCES t1(a)) ENGINE=InnoDB;
33
+ XA START 'a';
34
+ INSERT INTO t3 SET a=1;
35
+ INSERT INTO t3 SET a=42;
36
+ ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
37
+ XA END 'a';
38
+ XA PREPARE 'a';
33
39
SET GLOBAL innodb_fast_shutdown=0;
34
40
# restart
41
+ XA COMMIT 'a';
42
+ SELECT * FROM t3;
43
+ a
44
+ 1
45
+ DROP TABLE t3,t1;
35
46
XA ROLLBACK 'y';
Original file line number Diff line number Diff line change @@ -10,12 +10,12 @@ call mtr.add_suppression("Found [12] prepared XA transactions");
10
10
FLUSH TABLES;
11
11
--enable_query_log
12
12
13
- CREATE TABLE t1 (a INT) ENGINE=InnoDB;
13
+ CREATE TABLE t1 (a INT PRIMARY KEY ) ENGINE=InnoDB;
14
14
INSERT INTO t1 VALUES (1);
15
15
connect (con1,localhost,root);
16
16
XA START 'x'; UPDATE t1 set a=2; XA END 'x'; XA PREPARE 'x';
17
17
connect (con2,localhost,root);
18
- CREATE TABLE t2 (a INT) ENGINE=InnoDB;
18
+ CREATE TABLE t2 (a INT PRIMARY KEY ) ENGINE=InnoDB;
19
19
XA START 'y'; INSERT INTO t2 VALUES (1); XA END 'y'; XA PREPARE 'y';
20
20
connection default;
21
21
@@ -53,9 +53,18 @@ SELECT * FROM t1;
53
53
XA ROLLBACK 'x';
54
54
SELECT * FROM t1;
55
55
56
- DROP TABLE t1;
56
+ CREATE TABLE t3(a INT PRIMARY KEY REFERENCES t1(a)) ENGINE=InnoDB;
57
+ XA START 'a';
58
+ INSERT INTO t3 SET a=1;
59
+ --error ER_NO_REFERENCED_ROW_2
60
+ INSERT INTO t3 SET a=42;
61
+ XA END 'a';
62
+ XA PREPARE 'a';
57
63
58
64
SET GLOBAL innodb_fast_shutdown=0;
59
65
--source include/restart_mysqld.inc
60
66
67
+ XA COMMIT 'a';
68
+ SELECT * FROM t3;
69
+ DROP TABLE t3,t1;
61
70
XA ROLLBACK 'y';
Original file line number Diff line number Diff line change @@ -554,6 +554,7 @@ trx_free_at_shutdown(trx_t *trx)
554
554
trx->state = TRX_STATE_NOT_STARTED;
555
555
ut_ad (!UT_LIST_GET_LEN (trx->lock .trx_locks ));
556
556
trx->id = 0 ;
557
+ ut_d (*trx->detailed_error = ' \0 ' );
557
558
trx->free ();
558
559
}
559
560
You can’t perform that action at this time.
0 commit comments