diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/suite/innodb/r/innodb-alter-tempfile.result | 16 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/alter_crash.test | 16 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/innodb-alter-tempfile.test | 47 |
3 files changed, 24 insertions, 55 deletions
diff --git a/mysql-test/suite/innodb/r/innodb-alter-tempfile.result b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result index ce13ad0978b..b164c3c26b0 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-tempfile.result +++ b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result @@ -4,17 +4,10 @@ # Temporary tablename will be unique. This makes sure that future # in-place ALTERs of the same table will not be blocked due to # temporary tablename. -# Crash the server in ha_innobase::commit_inplace_alter_table() CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=innodb; -SET debug='d,innodb_alter_commit_crash_before_commit'; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead -# Write file to make mysql-test-run.pl expect crash -# Execute the statement that causes the crash +SET debug_dbug='+d,innodb_alter_commit_crash_before_commit'; ALTER TABLE t1 ADD PRIMARY KEY (f2, f1); ERROR HY000: Lost connection to MySQL server during query -# Startup the server after the crash -# Read and remember the temporary table name show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -23,13 +16,6 @@ t1 CREATE TABLE `t1` ( ) ENGINE=InnoDB DEFAULT CHARSET=latin1 # Consecutive Alter table does not create same temporary file name ALTER TABLE t1 ADD PRIMARY KEY (f2, f1); -# Shutdown the server to allow manual recovery -# Manual recovery begin. The dictionary was not updated -# and the files were not renamed. The rebuilt table -# was left behind on purpose, to faciliate data recovery. -# Manual recovery end -# Startup the server after manual recovery -# Drop the orphaned rebuilt table. show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/innodb/t/alter_crash.test b/mysql-test/suite/innodb/t/alter_crash.test index 54cc51aecf4..b4fdfd2f2d5 100644 --- a/mysql-test/suite/innodb/t/alter_crash.test +++ b/mysql-test/suite/innodb/t/alter_crash.test @@ -138,24 +138,27 @@ ALTER TABLE t2 ADD PRIMARY KEY (f2, f1); let $temp_table_name = `SELECT SUBSTRING(name,6) FROM information_schema.innodb_sys_tables WHERE name LIKE "test/#sql-ib$orig_table_id%"`; -# This second copy is an environment variable for the perl script below. -let temp_table_name = $temp_table_name; --echo # Manual *.frm recovery begin. The dictionary was not updated --echo # and the files were not renamed. The rebuilt table --echo # was left behind on purpose, to faciliate data recovery. +let TABLENAME_INC= $MYSQLTEST_VARDIR/tmp/tablename.inc; perl; -my @frm_file = glob "$ENV{'datadir'}/test/#sql-*.frm"; -my $target_frm = "$ENV{'datadir'}/test/$ENV{'temp_table_name'}.frm"; -rename($frm_file[0], $target_frm); +die unless open OUT, ">$ENV{TABLENAME_INC}"; +chdir "$ENV{'datadir'}/test"; +my @frm_file = map { substr($_, 0, -4) } glob "#sql-*.frm"; +print OUT 'let $tablename=', $frm_file[0], ';'; +close OUT or die; EOF +source $TABLENAME_INC; +remove_file $TABLENAME_INC; --echo # Manual recovery end --echo # Drop the orphaned rebuilt table. --disable_query_log -eval DROP TABLE `#mysql50#$temp_table_name`; +eval DROP TABLE `#mysql50#$tablename`; --enable_query_log SHOW TABLES; @@ -186,7 +189,6 @@ SET DEBUG_DBUG='+d,innodb_alter_commit_crash_after_commit'; let $orig_table_id = `select table_id from information_schema.innodb_sys_tables where name = 'test/t1'`; -# FIXME: MDEV-9469 'Incorrect key file' on ALTER TABLE # Write file to make mysql-test-run.pl expect crash --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # diff --git a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test index d3f34b12ea6..f2038da8c4c 100644 --- a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test +++ b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test @@ -24,49 +24,30 @@ let datadir= `select @@datadir`; --let $_server_id= `SELECT @@server_id` --let $_expect_file_name=$MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect ---echo # Crash the server in ha_innobase::commit_inplace_alter_table() CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=innodb; -SET debug='d,innodb_alter_commit_crash_before_commit'; +SET debug_dbug='+d,innodb_alter_commit_crash_before_commit'; -let $orig_table_id = `SELECT table_id - FROM information_schema.innodb_sys_tables - WHERE name = 'test/t1'`; +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---echo # Write file to make mysql-test-run.pl expect crash ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect - ---echo # Execute the statement that causes the crash --error 2013 ALTER TABLE t1 ADD PRIMARY KEY (f2, f1); ---echo # Startup the server after the crash ---source include/start_mysqld.inc - ---echo # Read and remember the temporary table name -let $temp_table_name = `SELECT SUBSTRING(name,6) - FROM information_schema.innodb_sys_tables - WHERE name LIKE "test/#sql-ib$orig_table_id%"`; -# This second copy is an environment variable for the perl script below. -let temp_table_name = $temp_table_name; -show create table t1; ---echo # Consecutive Alter table does not create same temporary file name -ALTER TABLE t1 ADD PRIMARY KEY (f2, f1); ---echo # Shutdown the server to allow manual recovery ---source include/shutdown_mysqld.inc - ---echo # Manual recovery begin. The dictionary was not updated ---echo # and the files were not renamed. The rebuilt table ---echo # was left behind on purpose, to faciliate data recovery. +let TABLENAME_INC= $MYSQLTEST_VARDIR/tmp/tablename.inc; perl; -my @frm_file = glob "$ENV{'datadir'}/test/#sql-*.frm"; -my $target_frm = "$ENV{'datadir'}/test/$ENV{'temp_table_name'}.frm"; -rename($frm_file[0], $target_frm); +die unless open OUT, ">$ENV{TABLENAME_INC}"; +chdir "$ENV{'datadir'}/test"; +my @frm_file = map { substr($_, 0, -4) } glob "#sql-*.frm"; +print OUT 'let $temp_table_name=', $frm_file[0], ';'; +close OUT or die; EOF ---echo # Manual recovery end ---echo # Startup the server after manual recovery +source $TABLENAME_INC; +remove_file $TABLENAME_INC; + --source include/start_mysqld.inc ---echo # Drop the orphaned rebuilt table. +show create table t1; +--echo # Consecutive Alter table does not create same temporary file name +ALTER TABLE t1 ADD PRIMARY KEY (f2, f1); --disable_query_log eval DROP TABLE `#mysql50#$temp_table_name`; --enable_query_log |