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# 15CREATE TABLE bug_53756 (pk INT, c1 INT) ENGINE=InnoDB; 16ALTER TABLE bug_53756 ADD PRIMARY KEY (pk); 17INSERT INTO bug_53756 VALUES(1, 11), (2, 22), (3, 33), (4, 44); 18 19--echo 20--echo # Select a less restrictive isolation level. 21SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; 22SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; 23COMMIT; 24 25--echo 26--echo # Start a transaction in the default connection for isolation. 27START TRANSACTION; 28SELECT @@tx_isolation; 29SELECT * FROM bug_53756; 30 31--connect (con1,localhost,root,,) 32START TRANSACTION; 33SELECT @@tx_isolation; 34DELETE FROM bug_53756 WHERE pk=1; 35 36--connect (con2,localhost,root,,) 37START TRANSACTION; 38SELECT @@tx_isolation; 39DELETE FROM bug_53756 WHERE pk=2; 40 41--connect (con3,localhost,root,,) 42START TRANSACTION; 43SELECT @@tx_isolation; 44UPDATE bug_53756 SET c1=77 WHERE pk=3; 45 46--connect (con4,localhost,root,,) 47START TRANSACTION; 48SELECT @@tx_isolation; 49UPDATE bug_53756 SET c1=88 WHERE pk=4; 50 51--connect (con5,localhost,root,,) 52START TRANSACTION; 53SELECT @@tx_isolation; 54INSERT INTO bug_53756 VALUES(5, 55); 55 56--connect (con6,localhost,root,,) 57START TRANSACTION; 58SELECT @@tx_isolation; 59INSERT INTO bug_53756 VALUES(6, 66); 60 61--connection con1 62COMMIT; 63 64--connection con3 65COMMIT; 66 67--connection con4 68ROLLBACK; 69 70--connection con6 71ROLLBACK; 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 82SELECT * FROM bug_53756; 83 84START TRANSACTION; 85INSERT 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 103SELECT * FROM bug_53756; 104 105DROP TABLE bug_53756; 106