./r/recover_alter.reject0000644000567100056710000000436111374537317016723 0ustar istruewingistruewingDROP TABLE IF EXISTS t1; CREATE TABLE t1 (pk INT, c1 INT) ENGINE=InnoDB; ALTER TABLE t1 ADD PRIMARY KEY (pk); INSERT INTO t1 VALUES(1, 11), (2, 22), (3, 33), (4, 44); COMMIT; # Select a less restrictive isolation level. SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; COMMIT; # Start a transaction in the default connection for isolation. START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED SELECT * FROM t1; pk c1 1 11 2 22 3 33 4 44 # connection con1 deletes row 1 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED DELETE FROM t1 WHERE pk=1; # connection con2 deletes row 2 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED DELETE FROM t1 WHERE pk=2; # connection con3 updates row 3 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED UPDATE t1 SET c1=77 WHERE pk=3; # connection con4 updates row 4 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED UPDATE t1 SET c1=88 WHERE pk=4; # connection con5 inserts row 5 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED INSERT INTO t1 VALUES(5, 55); # connection con6 inserts row 6 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED INSERT INTO t1 VALUES(6, 66); # connection con1 commits. COMMIT; # connection con3 commits. COMMIT; # connection con4 rolls back. ROLLBACK; # connection con6 rolls back. ROLLBACK; # The connections 2 and 5 stay open. # connection default selects resulting data. # Delete of row 1 was committed. # Dpdate of row 3 was committed. # Due to isolation level read committed, these should be included. # All other changes should not be included. SELECT * FROM t1; pk c1 2 22 3 77 4 44 # connection default # # Crash server. START TRANSACTION; INSERT INTO t1 VALUES (666,666); SET SESSION debug="+d,crash_commit_before"; COMMIT; ERROR HY000: Lost connection to MySQL server during query # # disconnect con1, con2, con3, con4, con5, con6. # # Restart server. # # Select recovered data. # Delete of row 1 was committed. # Dpdate of row 3 was committed. # These should be included. # All other changes should not be included. SELECT * FROM t1; pk c1 3 77 4 44 5 55 # Clean up. DROP TABLE t1; ./r/recover_alter.result0000644000567100056710000000436111374537204016760 0ustar istruewingistruewingDROP TABLE IF EXISTS t1; CREATE TABLE t1 (pk INT, c1 INT) ENGINE=InnoDB; ALTER TABLE t1 ADD PRIMARY KEY (pk); INSERT INTO t1 VALUES(1, 11), (2, 22), (3, 33), (4, 44); COMMIT; # Select a less restrictive isolation level. SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; COMMIT; # Start a transaction in the default connection for isolation. START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED SELECT * FROM t1; pk c1 1 11 2 22 3 33 4 44 # connection con1 deletes row 1 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED DELETE FROM t1 WHERE pk=1; # connection con2 deletes row 2 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED DELETE FROM t1 WHERE pk=2; # connection con3 updates row 3 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED UPDATE t1 SET c1=77 WHERE pk=3; # connection con4 updates row 4 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED UPDATE t1 SET c1=88 WHERE pk=4; # connection con5 inserts row 5 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED INSERT INTO t1 VALUES(5, 55); # connection con6 inserts row 6 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED INSERT INTO t1 VALUES(6, 66); # connection con1 commits. COMMIT; # connection con3 commits. COMMIT; # connection con4 rolls back. ROLLBACK; # connection con6 rolls back. ROLLBACK; # The connections 2 and 5 stay open. # connection default selects resulting data. # Delete of row 1 was committed. # Dpdate of row 3 was committed. # Due to isolation level read committed, these should be included. # All other changes should not be included. SELECT * FROM t1; pk c1 2 22 3 77 4 44 # connection default # # Crash server. START TRANSACTION; INSERT INTO t1 VALUES (666,666); SET SESSION debug="+d,crash_commit_before"; COMMIT; ERROR HY000: Lost connection to MySQL server during query # # disconnect con1, con2, con3, con4, con5, con6. # # Restart server. # # Select recovered data. # Delete of row 1 was committed. # Dpdate of row 3 was committed. # These should be included. # All other changes should not be included. SELECT * FROM t1; pk c1 2 22 3 77 4 44 # Clean up. DROP TABLE t1; ./r/recover_simple.result0000644000567100056710000000433011374537431017140 0ustar istruewingistruewingDROP TABLE IF EXISTS t1; CREATE TABLE t1 (pk INT PRIMARY KEY, c1 INT) ENGINE=InnoDB; INSERT INTO t1 VALUES(1, 11), (2, 22), (3, 33), (4, 44); COMMIT; # Select a less restrictive isolation level. SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; COMMIT; # Start a transaction in the default connection for isolation. START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED SELECT * FROM t1; pk c1 1 11 2 22 3 33 4 44 # connection con1 deletes row 1 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED DELETE FROM t1 WHERE pk=1; # connection con2 deletes row 2 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED DELETE FROM t1 WHERE pk=2; # connection con3 updates row 3 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED UPDATE t1 SET c1=77 WHERE pk=3; # connection con4 updates row 4 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED UPDATE t1 SET c1=88 WHERE pk=4; # connection con5 inserts row 5 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED INSERT INTO t1 VALUES(5, 55); # connection con6 inserts row 6 START TRANSACTION; SELECT @@tx_isolation; @@tx_isolation READ-COMMITTED INSERT INTO t1 VALUES(6, 66); # connection con1 commits. COMMIT; # connection con3 commits. COMMIT; # connection con4 rolls back. ROLLBACK; # connection con6 rolls back. ROLLBACK; # The connections 2 and 5 stay open. # connection default selects resulting data. # Delete of row 1 was committed. # Dpdate of row 3 was committed. # Due to isolation level read committed, these should be included. # All other changes should not be included. SELECT * FROM t1; pk c1 2 22 3 77 4 44 # connection default # # Crash server. START TRANSACTION; INSERT INTO t1 VALUES (666,666); SET SESSION debug="+d,crash_commit_before"; COMMIT; ERROR HY000: Lost connection to MySQL server during query # # disconnect con1, con2, con3, con4, con5, con6. # # Restart server. # # Select recovered data. # Delete of row 1 was committed. # Dpdate of row 3 was committed. # These should be included. # All other changes should not be included. SELECT * FROM t1; pk c1 2 22 3 77 4 44 # Clean up. DROP TABLE t1; ./t/recover_alter-master.opt0000644000567100056710000000004511374210046017522 0ustar istruewingistruewing--skip-stack-trace --skip-core-file ./t/recover_alter.test0000644000567100056710000001024011374537115016415 0ustar istruewingistruewing# # WL#5322 - Verify data consistency in IHB # # # innobackup needs to connect to the server. Not supported in embedded. --source include/not_embedded.inc # # This test case needs to crash the server. Needs a debug server. --source include/have_debug.inc # # Don't test this under valgrind, memory leaks will occur. --source include/not_valgrind.inc # # This test case needs InnoDB. --source include/have_innodb.inc # # Precautionary clean up. # --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings # # Create test data. # CREATE TABLE t1 (pk INT, c1 INT) ENGINE=InnoDB; ALTER TABLE t1 ADD PRIMARY KEY (pk); INSERT INTO t1 VALUES(1, 11), (2, 22), (3, 33), (4, 44); COMMIT; --echo --echo # Select a less restrictive isolation level. # Don't use user variables. They won't survive server crash. --let $global_isolation= `SELECT @@global.tx_isolation`; --let $session_isolation= `SELECT @@session.tx_isolation`; SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; COMMIT; --echo --echo # Start a transaction in the default connection for isolation. START TRANSACTION; SELECT @@tx_isolation; SELECT * FROM t1; --echo --echo # connection con1 deletes row 1 --connect (con1,localhost,root,,) START TRANSACTION; SELECT @@tx_isolation; DELETE FROM t1 WHERE pk=1; --echo --echo # connection con2 deletes row 2 --connect (con2,localhost,root,,) START TRANSACTION; SELECT @@tx_isolation; DELETE FROM t1 WHERE pk=2; --echo --echo # connection con3 updates row 3 --connect (con3,localhost,root,,) START TRANSACTION; SELECT @@tx_isolation; UPDATE t1 SET c1=77 WHERE pk=3; --echo --echo # connection con4 updates row 4 --connect (con4,localhost,root,,) START TRANSACTION; SELECT @@tx_isolation; UPDATE t1 SET c1=88 WHERE pk=4; --echo --echo # connection con5 inserts row 5 --connect (con5,localhost,root,,) START TRANSACTION; SELECT @@tx_isolation; INSERT INTO t1 VALUES(5, 55); --echo --echo # connection con6 inserts row 6 --connect (con6,localhost,root,,) START TRANSACTION; SELECT @@tx_isolation; INSERT INTO t1 VALUES(6, 66); --echo --echo # connection con1 commits. --connection con1 COMMIT; --echo --echo # connection con3 commits. --connection con3 COMMIT; --echo --echo # connection con4 rolls back. --connection con4 ROLLBACK; --echo --echo # connection con6 rolls back. --connection con6 ROLLBACK; --echo --echo # The connections 2 and 5 stay open. --echo --echo # connection default selects resulting data. --echo # Delete of row 1 was committed. --echo # Dpdate of row 3 was committed. --echo # Due to isolation level read committed, these should be included. --echo # All other changes should not be included. --connection default SELECT * FROM t1; --echo --echo # connection default --connection default --echo # --echo # Crash server. # # Write file to make mysql-test-run.pl expect the "crash", but don't start # it until it's told to --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # START TRANSACTION; INSERT INTO t1 VALUES (666,666); # # Request a crash on next execution of commit. SET SESSION debug="+d,crash_commit_before"; # # Execute the statement that causes the crash. --error 2013 COMMIT; --echo --echo # --echo # disconnect con1, con2, con3, con4, con5, con6. --disconnect con1 --disconnect con2 --disconnect con3 --disconnect con4 --disconnect con5 --disconnect con6 --echo # --echo # Restart server. # # Write file to make mysql-test-run.pl start up the server again --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # # Turn on reconnect --enable_reconnect # # Call script that will poll the server waiting for it to be back online again --source include/wait_until_connected_again.inc # # Turn off reconnect again --disable_reconnect --echo --echo # --echo # Select recovered data. --echo # Delete of row 1 was committed. --echo # Dpdate of row 3 was committed. --echo # These should be included. --echo # All other changes should not be included. SELECT * FROM t1; --echo --echo # Clean up. DROP TABLE t1; # # Funny that this isn't implicitly reset to default by server restart. --disable_query_log eval SET GLOBAL tx_isolation= '$global_isolation'; eval SET SESSION tx_isolation= '$session_isolation'; --enable_query_log ./t/recover_simple-master.opt0000644000567100056710000000004511374210046017704 0ustar istruewingistruewing--skip-stack-trace --skip-core-file ./t/recover_simple.test0000644000567100056710000001020711374537306016604 0ustar istruewingistruewing# # WL#5322 - Verify data consistency in IHB # # # innobackup needs to connect to the server. Not supported in embedded. --source include/not_embedded.inc # # This test case needs to crash the server. Needs a debug server. --source include/have_debug.inc # # Don't test this under valgrind, memory leaks will occur. --source include/not_valgrind.inc # # This test case needs InnoDB. --source include/have_innodb.inc # # Precautionary clean up. # --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings # # Create test data. # CREATE TABLE t1 (pk INT PRIMARY KEY, c1 INT) ENGINE=InnoDB; INSERT INTO t1 VALUES(1, 11), (2, 22), (3, 33), (4, 44); COMMIT; --echo --echo # Select a less restrictive isolation level. # Don't use user variables. They won't survive server crash. --let $global_isolation= `SELECT @@global.tx_isolation`; --let $session_isolation= `SELECT @@session.tx_isolation`; SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; COMMIT; --echo --echo # Start a transaction in the default connection for isolation. START TRANSACTION; SELECT @@tx_isolation; SELECT * FROM t1; --echo --echo # connection con1 deletes row 1 --connect (con1,localhost,root,,) START TRANSACTION; SELECT @@tx_isolation; DELETE FROM t1 WHERE pk=1; --echo --echo # connection con2 deletes row 2 --connect (con2,localhost,root,,) START TRANSACTION; SELECT @@tx_isolation; DELETE FROM t1 WHERE pk=2; --echo --echo # connection con3 updates row 3 --connect (con3,localhost,root,,) START TRANSACTION; SELECT @@tx_isolation; UPDATE t1 SET c1=77 WHERE pk=3; --echo --echo # connection con4 updates row 4 --connect (con4,localhost,root,,) START TRANSACTION; SELECT @@tx_isolation; UPDATE t1 SET c1=88 WHERE pk=4; --echo --echo # connection con5 inserts row 5 --connect (con5,localhost,root,,) START TRANSACTION; SELECT @@tx_isolation; INSERT INTO t1 VALUES(5, 55); --echo --echo # connection con6 inserts row 6 --connect (con6,localhost,root,,) START TRANSACTION; SELECT @@tx_isolation; INSERT INTO t1 VALUES(6, 66); --echo --echo # connection con1 commits. --connection con1 COMMIT; --echo --echo # connection con3 commits. --connection con3 COMMIT; --echo --echo # connection con4 rolls back. --connection con4 ROLLBACK; --echo --echo # connection con6 rolls back. --connection con6 ROLLBACK; --echo --echo # The connections 2 and 5 stay open. --echo --echo # connection default selects resulting data. --echo # Delete of row 1 was committed. --echo # Dpdate of row 3 was committed. --echo # Due to isolation level read committed, these should be included. --echo # All other changes should not be included. --connection default SELECT * FROM t1; --echo --echo # connection default --connection default --echo # --echo # Crash server. # # Write file to make mysql-test-run.pl expect the "crash", but don't start # it until it's told to --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # START TRANSACTION; INSERT INTO t1 VALUES (666,666); # # Request a crash on next execution of commit. SET SESSION debug="+d,crash_commit_before"; # # Execute the statement that causes the crash. --error 2013 COMMIT; --echo --echo # --echo # disconnect con1, con2, con3, con4, con5, con6. --disconnect con1 --disconnect con2 --disconnect con3 --disconnect con4 --disconnect con5 --disconnect con6 --echo # --echo # Restart server. # # Write file to make mysql-test-run.pl start up the server again --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # # Turn on reconnect --enable_reconnect # # Call script that will poll the server waiting for it to be back online again --source include/wait_until_connected_again.inc # # Turn off reconnect again --disable_reconnect --echo --echo # --echo # Select recovered data. --echo # Delete of row 1 was committed. --echo # Dpdate of row 3 was committed. --echo # These should be included. --echo # All other changes should not be included. SELECT * FROM t1; --echo --echo # Clean up. DROP TABLE t1; # # Funny that this isn't implicitly reset to default by server restart. --disable_query_log eval SET GLOBAL tx_isolation= '$global_isolation'; eval SET SESSION tx_isolation= '$session_isolation'; --enable_query_log