File: innodb_rollback_on_timeout.inc

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 (80 lines) | stat: -rw-r--r-- 1,952 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
#
# Bug #24200: Provide backwards compatibility mode for 4.x "rollback on
# transaction timeout"
#
--disable_warnings
drop table if exists t1;
--enable_warnings

show variables like 'innodb_rollback_on_timeout';
create table t1 (a int unsigned not null primary key) engine = innodb;
insert into t1 values (1);
commit;
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);

connection con2;
begin work;
insert into t1 values (2);
select * from t1;

connection con1;
begin work;
insert into t1 values (5);
select * from t1;
# Lock wait timeout set to 2 seconds in <THIS TEST>-master.opt; this
# statement will time out; in 5.0.13+, it will not roll back transaction.
--error ER_LOCK_WAIT_TIMEOUT
insert into t1 values (2);
# On 5.0.13+, this should give ==> 1, 5
select * from t1;
commit;

connection con2;
select * from t1;
commit;

connection default;
select * from t1;
drop table t1;
disconnect con1;
disconnect con2;

--echo End of 5.0 tests


--echo #
--echo # Bug#23753319: !M_THD->TRANSACTION_ROLLBACK_REQUEST' AT
--echo # THD::ATTACHABLE_TRX::INIT IN SQL/SQL_C
--echo #

create table t1 (i int);
insert into t1 values (42);

--echo # Grab locks which will block another con from doing select in RR
BEGIN;
select * from t1 for update;

--echo # Create competing connection using RR
connect (rr_con,localhost,root,,);
BEGIN;
set session transaction isolation level repeatable read;

--echo # Will fail and request rollback due to blocking for update
--echo # (prior to fix this would trigger the assert).
--error ER_LOCK_WAIT_TIMEOUT
create table t2 as select * from t1;

--echo # Additional coverage for WL#7743 "New data dictionary: changes
--echo # to DDL-related parts of SE API". Check how rollback is handled
--echo # by similar CTS for non-transactional table.
BEGIN;
--error ER_LOCK_WAIT_TIMEOUT
create table t2 engine=myisam as select * from t1;

--echo # Cleanup
connection default;
disconnect rr_con;

COMMIT;
drop table t1;