Debian Codegraph @

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

raw
1 --source include/have_innodb.inc
2 # This is the test case for bug #53756. Alter table operation could
3 # leave a deleted record for the temp table (later renamed to the altered
4 # table) in the SYS_TABLES secondary index, we should ignore this row and
5 # find the first non-deleted row for the specified table_id when load table
6 # metadata in the function dict_load_table_on_id() during crash recovery.
7
8 #
9 # The embedded server test does not support restarting.
10 --source include/not_embedded.inc
11
12 #
13 # Create test data.
14 #
15 CREATE TABLE bug_53756 (pk INT, c1 INT) ENGINE=InnoDB;
16 ALTER TABLE bug_53756 ADD PRIMARY KEY (pk);
17 INSERT INTO bug_53756 VALUES(1, 11), (2, 22), (3, 33), (4, 44);
18
19 --echo
20 --echo # Select a less restrictive isolation level.
21 SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
22 SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
23 COMMIT;
24
25 --echo
26 --echo # Start a transaction in the default connection for isolation.
27 START TRANSACTION;
28 SELECT @@transaction_isolation;
29 SELECT * FROM bug_53756;
30
31 --connect (con1,localhost,root,,)
32 START TRANSACTION;
33 SELECT @@transaction_isolation;
34 DELETE FROM bug_53756 WHERE pk=1;
35
36 --connect (con2,localhost,root,,)
37 START TRANSACTION;
38 SELECT @@transaction_isolation;
39 DELETE FROM bug_53756 WHERE pk=2;
40
41 --connect (con3,localhost,root,,)
42 START TRANSACTION;
43 SELECT @@transaction_isolation;
44 UPDATE bug_53756 SET c1=77 WHERE pk=3;
45
46 --connect (con4,localhost,root,,)
47 START TRANSACTION;
48 SELECT @@transaction_isolation;
49 UPDATE bug_53756 SET c1=88 WHERE pk=4;
50
51 --connect (con5,localhost,root,,)
52 START TRANSACTION;
53 SELECT @@transaction_isolation;
54 INSERT INTO bug_53756 VALUES(5, 55);
55
56 --connect (con6,localhost,root,,)
57 START TRANSACTION;
58 SELECT @@transaction_isolation;
59 INSERT INTO bug_53756 VALUES(6, 66);
60
61 --connection con1
62 COMMIT;
63
64 --connection con3
65 COMMIT;
66
67 --connection con4
68 ROLLBACK;
69
70 --connection con6
71 ROLLBACK;
72
73 --echo
74 --echo # The connections 2 and 5 stay open.
75
76 --echo
77 --echo # Delete of row 1 was committed.
78 --echo # Update of row 3 was committed.
79 --echo # Due to isolation level read committed, these should be included.
80 --echo # All other changes should not be included.
81 --connection default
82 SELECT * FROM bug_53756;
83
84 START TRANSACTION;
85 INSERT INTO bug_53756 VALUES (666,666);
86
87 --let $shutdown_timeout=0
88 --source include/restart_mysqld.inc
89 --disconnect con1
90 --disconnect con2
91 --disconnect con3
92 --disconnect con4
93 --disconnect con5
94 --disconnect con6
95
96 --echo #
97 --echo # Select recovered data.
98 --echo # Delete of row 1 was committed.
99 --echo # Update of row 3 was committed.
100 --echo # These should be included.
101 --echo # All other changes should not be included.
102 --echo # Delete of row 2 and insert of row 5 should be rolled back
103 SELECT * FROM bug_53756;
104
105 DROP TABLE bug_53756;