diff --git a/mysql-test/suite/innodb/r/innodb-32k-crash.result b/mysql-test/suite/innodb/r/innodb-32k-crash.result index c9b21bf414a..3286cc8d55c 100644 --- a/mysql-test/suite/innodb/r/innodb-32k-crash.result +++ b/mysql-test/suite/innodb/r/innodb-32k-crash.result @@ -118,10 +118,10 @@ UPDATE t2 SET ka=@l,la=@l,ma=@l,na=@l,oa=@l,pa=@l; UPDATE t2 SET qa=@l,ra=@l,sa=@l,ta=@l,ua=@l; UPDATE t2 SET va=@l,wa=@l,xa=@l,ya=@l,za=@l; COMMIT; +BEGIN; INSERT INTO t1 SELECT * from t2; -SET DEBUG_DBUG='+d,crash_commit_before'; UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e; -ERROR HY000: Lost connection to MySQL server during query +# Kill and restart UPDATE t1 SET a=@f,b=@f,c=@f,d=@f,e=@f,f=@f,g=@f,h=@f,i=@f,j=@f, k=@f,l=@f,m=@f,n=@f,o=@f,p=@f,q=@f,r=@f,s=@f,t=@f,u=@f, v=@f,w=@f,x=@b,y=@f,z=@f, diff --git a/mysql-test/suite/innodb/r/innodb-64k-crash.result b/mysql-test/suite/innodb/r/innodb-64k-crash.result index 9371c4a09e5..cad855cae2b 100644 --- a/mysql-test/suite/innodb/r/innodb-64k-crash.result +++ b/mysql-test/suite/innodb/r/innodb-64k-crash.result @@ -261,7 +261,8 @@ UPDATE t2 SET kc=@i,lc=@i,mc=@i,nc=@i,oc=@i,pc=@i; UPDATE t2 SET qc=@i,rc=@i,sc=@i,tc=@i,uc=@i; UPDATE t2 SET vc=@i,wc=@i,xc=@i,yc=@i,zc=@i; COMMIT; -SET DEBUG_DBUG='+d,crash_commit_before'; +BEGIN; +INSERT INTO t1 SELECT * from t2; UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c, k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c, v=@c,w=@c,x=@c,y=@c,z=@c, @@ -274,7 +275,7 @@ vb=@c,wb=@c,xb=@c,yb=@c,zb=@c, ac=@c,bc=@c,cc=@c,dc=@c,ec=@c,fc=@c,gc=@c,hc=@c,ic=@c,jc=@c, kc=@c,lc=@c,mc=@c,nc=@c,oc=@c,pc=@c,qc=@c,rc=@c,sc=@c,tc=@c,uc=@c, vc=@c,wc=@c,xc=@c,yc=@c,zc=@c; -ERROR HY000: Lost connection to MySQL server during query +# Kill and restart UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e,f=@e,g=@e,h=@e,i=@e,j=@e, k=@e,l=@e,m=@e,n=@e,o=@e,p=@e,q=@e,r=@e,s=@e,t=@e,u=@e, v=@e,w=@e,x=@e,y=@e,z=@e, diff --git a/mysql-test/suite/innodb/r/innodb-blob.result b/mysql-test/suite/innodb/r/innodb-blob.result index a90f83945e0..eca77972400 100644 --- a/mysql-test/suite/innodb/r/innodb-blob.result +++ b/mysql-test/suite/innodb/r/innodb-blob.result @@ -33,9 +33,9 @@ a 1 2 3 -SET DEBUG_DBUG='+d,crash_commit_before'; +BEGIN; INSERT INTO t2 VALUES (42); -ERROR HY000: Lost connection to MySQL server during query +# Kill and restart ERROR HY000: Lost connection to MySQL server during query CHECK TABLE t1; Table Op Msg_type Msg_text @@ -70,9 +70,7 @@ SELECT info FROM information_schema.processlist WHERE state = 'debug sync point: before_row_upd_extern'; info UPDATE t3 SET c=REPEAT('i',3000) WHERE a=2 -SET DEBUG_DBUG='+d,crash_commit_before'; -COMMIT; -ERROR HY000: Lost connection to MySQL server during query +# Kill and restart ERROR HY000: Lost connection to MySQL server during query CHECK TABLE t1,t2,t3; Table Op Msg_type Msg_text @@ -97,9 +95,7 @@ SELECT info FROM information_schema.processlist WHERE state = 'debug sync point: after_row_upd_extern'; info UPDATE t3 SET c=REPEAT('j',3000) WHERE a=2 -SET DEBUG_DBUG='+d,crash_commit_before'; -COMMIT; -ERROR HY000: Lost connection to MySQL server during query +# Kill and restart ERROR HY000: Lost connection to MySQL server during query CHECK TABLE t1,t2,t3; Table Op Msg_type Msg_text diff --git a/mysql-test/suite/innodb/r/innodb_bug53756.result b/mysql-test/suite/innodb/r/innodb_bug53756.result index 2a2a30e2482..bbaeb0b4060 100644 --- a/mysql-test/suite/innodb/r/innodb_bug53756.result +++ b/mysql-test/suite/innodb/r/innodb_bug53756.result @@ -1,4 +1,3 @@ -DROP TABLE IF EXISTS bug_53756 ; CREATE TABLE bug_53756 (pk INT, c1 INT) ENGINE=InnoDB; ALTER TABLE bug_53756 ADD PRIMARY KEY (pk); INSERT INTO bug_53756 VALUES(1, 11), (2, 22), (3, 33), (4, 44); @@ -86,21 +85,9 @@ pk c1 2 22 3 77 4 44 - -# connection default -# -# Crash server. START TRANSACTION; INSERT INTO bug_53756 VALUES (666,666); -SET SESSION debug_dbug="+d,crash_commit_before"; -COMMIT; -ERROR HY000: Lost connection to MySQL server during query - -# -# disconnect con1, con2, con3, con4, con5, con6. -# -# Restart server. - +# Kill and restart # # Select recovered data. # Delete of row 1 was committed. @@ -113,6 +100,4 @@ pk c1 2 22 3 77 4 44 - -# Clean up. DROP TABLE bug_53756; diff --git a/mysql-test/suite/innodb/t/innodb-32k-crash.test b/mysql-test/suite/innodb/t/innodb-32k-crash.test index 8f2e7d6c1e2..435ea3646f8 100644 --- a/mysql-test/suite/innodb/t/innodb-32k-crash.test +++ b/mysql-test/suite/innodb/t/innodb-32k-crash.test @@ -1,22 +1,11 @@ --source include/have_innodb.inc --source include/have_innodb_32k.inc ---source include/have_debug.inc -# Valgrind would complain about memory leaks when we crash on purpose. ---source include/not_valgrind.inc -# Embedded server does not support crashing +# Embedded server does not support restarting --source include/not_embedded.inc -# Avoid CrashReporter popup on Mac ---source include/not_crashrep.inc call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *"); ---disable_query_log let $MYSQLD_DATADIR= `select @@datadir`; -# These values can change during the test -let $innodb_file_format_orig = `SELECT @@innodb_file_format`; -let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; -let $innodb_strict_mode_orig = `SELECT @@session.innodb_strict_mode`; ---enable_query_log SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_per_table = ON; @@ -155,17 +144,11 @@ UPDATE t2 SET qa=@l,ra=@l,sa=@l,ta=@l,ua=@l; UPDATE t2 SET va=@l,wa=@l,xa=@l,ya=@l,za=@l; COMMIT; +BEGIN; INSERT INTO t1 SELECT * from t2; - -SET DEBUG_DBUG='+d,crash_commit_before'; ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---error 2013 UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e; -# Write file to make mysql-test-run.pl restart the server ---enable_reconnect ---source include/wait_until_connected_again.inc ---disable_reconnect +--source include/kill_and_restart_mysqld.inc UPDATE t1 SET a=@f,b=@f,c=@f,d=@f,e=@f,f=@f,g=@f,h=@f,i=@f,j=@f, k=@f,l=@f,m=@f,n=@f,o=@f,p=@f,q=@f,r=@f,s=@f,t=@f,u=@f, @@ -210,13 +193,3 @@ COMMIT; show create table t1; show create table t2; drop table t1,t2; - -# -# restore environment to the state it was before this test execution -# - ---disable_query_log -EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig; -EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; -EVAL SET SESSION innodb_strict_mode = $innodb_strict_mode_orig; ---enable_query_log diff --git a/mysql-test/suite/innodb/t/innodb-64k-crash.test b/mysql-test/suite/innodb/t/innodb-64k-crash.test index 9d2d0d66415..a34dd313b30 100644 --- a/mysql-test/suite/innodb/t/innodb-64k-crash.test +++ b/mysql-test/suite/innodb/t/innodb-64k-crash.test @@ -1,22 +1,11 @@ --source include/have_innodb.inc --source include/have_innodb_64k.inc ---source include/have_debug.inc -# Valgrind would complain about memory leaks when we crash on purpose. ---source include/not_valgrind.inc -# Embedded server does not support crashing +# Embedded server does not support restarting --source include/not_embedded.inc -# Avoid CrashReporter popup on Mac ---source include/not_crashrep.inc call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *"); ---disable_query_log let $MYSQLD_DATADIR= `select @@datadir`; -# These values can change during the test -let $innodb_file_format_orig = `SELECT @@innodb_file_format`; -let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; -let $innodb_strict_mode_orig = `SELECT @@session.innodb_strict_mode`; ---enable_query_log SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_per_table = ON; @@ -301,10 +290,8 @@ UPDATE t2 SET qc=@i,rc=@i,sc=@i,tc=@i,uc=@i; UPDATE t2 SET vc=@i,wc=@i,xc=@i,yc=@i,zc=@i; COMMIT; - -SET DEBUG_DBUG='+d,crash_commit_before'; ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---error 2013 +BEGIN; +INSERT INTO t1 SELECT * from t2; UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c, k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c, v=@c,w=@c,x=@c,y=@c,z=@c, @@ -318,10 +305,7 @@ UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c, kc=@c,lc=@c,mc=@c,nc=@c,oc=@c,pc=@c,qc=@c,rc=@c,sc=@c,tc=@c,uc=@c, vc=@c,wc=@c,xc=@c,yc=@c,zc=@c; -# Write file to make mysql-test-run.pl restart the server ---enable_reconnect ---source include/wait_until_connected_again.inc ---disable_reconnect +--source include/kill_and_restart_mysqld.inc UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e,f=@e,g=@e,h=@e,i=@e,j=@e, k=@e,l=@e,m=@e,n=@e,o=@e,p=@e,q=@e,r=@e,s=@e,t=@e,u=@e, @@ -400,13 +384,3 @@ COMMIT; show create table t1; show create table t2; drop table t1,t2; - -# -# restore environment to the state it was before this test execution -# - ---disable_query_log -EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig; -EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; -EVAL SET SESSION innodb_strict_mode = $innodb_strict_mode_orig; ---enable_query_log diff --git a/mysql-test/suite/innodb/t/innodb-blob.test b/mysql-test/suite/innodb/t/innodb-blob.test index 8aa113fc3ca..775d52c9ce8 100644 --- a/mysql-test/suite/innodb/t/innodb-blob.test +++ b/mysql-test/suite/innodb/t/innodb-blob.test @@ -8,12 +8,8 @@ # DEBUG_SYNC must be compiled in. --source include/have_debug_sync.inc -# Valgrind would complain about memory leaks when we crash on purpose. ---source include/not_valgrind.inc -# Embedded server does not support crashing +# Embedded server does not support restarting --source include/not_embedded.inc -# Avoid CrashReporter popup on Mac ---source include/not_crashrep.inc CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT) ENGINE=InnoDB; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; @@ -68,11 +64,11 @@ SELECT a, RIGHT(b,20) FROM t1; SELECT a FROM t1; # Request a crash, and restart the server. -SET DEBUG_DBUG='+d,crash_commit_before'; ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---error 2013 +BEGIN; INSERT INTO t2 VALUES (42); +--source include/kill_and_restart_mysqld.inc + disconnect con1; disconnect con2; connection default; @@ -80,7 +76,6 @@ connection default; --error 2013 reap; -# Write file to make mysql-test-run.pl restart the server --enable_reconnect --source include/wait_until_connected_again.inc --disable_reconnect @@ -147,11 +142,7 @@ SET DEBUG_SYNC='now WAIT_FOR have_latch'; SELECT info FROM information_schema.processlist WHERE state = 'debug sync point: before_row_upd_extern'; -# Request a crash, and restart the server. -SET DEBUG_DBUG='+d,crash_commit_before'; ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---error 2013 -COMMIT; +--source include/kill_and_restart_mysqld.inc disconnect con2; connection default; @@ -159,7 +150,6 @@ connection default; --error 2013 reap; -# Write file to make mysql-test-run.pl restart the server --enable_reconnect --source include/wait_until_connected_again.inc --disable_reconnect @@ -191,11 +181,7 @@ SET DEBUG_SYNC='now WAIT_FOR have_latch'; SELECT info FROM information_schema.processlist WHERE state = 'debug sync point: after_row_upd_extern'; -# Request a crash, and restart the server. -SET DEBUG_DBUG='+d,crash_commit_before'; ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---error 2013 -COMMIT; +--source include/kill_and_restart_mysqld.inc disconnect con2; connection default; @@ -203,11 +189,9 @@ connection default; --error 2013 reap; -# Write file to make mysql-test-run.pl restart the server --enable_reconnect --source include/wait_until_connected_again.inc --disable_reconnect - CHECK TABLE t1,t2,t3; SELECT a, RIGHT(b,20), RIGHT(c,20) FROM t3; SELECT a FROM t3; diff --git a/mysql-test/suite/innodb/t/innodb_bug53756.test b/mysql-test/suite/innodb/t/innodb_bug53756.test index c298c945434..a9345440baa 100644 --- a/mysql-test/suite/innodb/t/innodb_bug53756.test +++ b/mysql-test/suite/innodb/t/innodb_bug53756.test @@ -6,24 +6,8 @@ # metadata in the function dict_load_table_on_id() during crash recovery. # -# innobackup needs to connect to the server. Not supported in embedded. +# The embedded server test does not support restarting. --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 - -# Avoid CrashReporter popup on Mac ---source include/not_crashrep.inc - -# -# Precautionary clean up. -# ---disable_warnings -DROP TABLE IF EXISTS bug_53756 ; ---enable_warnings # # Create test data. @@ -34,9 +18,6 @@ INSERT INTO bug_53756 VALUES(1, 11), (2, 22), (3, 33), (4, 44); --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; @@ -121,49 +102,16 @@ ROLLBACK; --connection default SELECT * FROM bug_53756; ---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 bug_53756 VALUES (666,666); -# -# Request a crash on next execution of commit. -SET SESSION debug_dbug="+d,crash_commit_before"; -# -# Write file to make mysql-test-run.pl start up the server again ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -# -# Execute the statement that causes the crash. ---error 2013 -COMMIT; ---echo ---echo # ---echo # disconnect con1, con2, con3, con4, con5, con6. + +--source include/kill_and_restart_mysqld.inc --disconnect con1 --disconnect con2 --disconnect con3 --disconnect con4 --disconnect con5 --disconnect con6 ---echo # ---echo # Restart server. -# -# 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. @@ -174,12 +122,4 @@ COMMIT; --echo # Delete of row 2 and insert of row 5 should be rolled back SELECT * FROM bug_53756; ---echo ---echo # Clean up. DROP TABLE bug_53756; - ---disable_query_log -eval SET GLOBAL tx_isolation= '$global_isolation'; -eval SET SESSION tx_isolation= '$session_isolation'; ---enable_query_log -