Commit 69e88de0 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-14585: Adjust the innodb.alter_crash test case

parent b4165985
...@@ -83,9 +83,8 @@ ALTER TABLE t2 ADD PRIMARY KEY (f2, f1); ...@@ -83,9 +83,8 @@ ALTER TABLE t2 ADD PRIMARY KEY (f2, f1);
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
# Startup the server after the crash # Startup the server after the crash
SELECT * FROM information_schema.innodb_sys_tables SELECT * FROM information_schema.innodb_sys_tables
WHERE name LIKE 'test/#sql-ib%'; WHERE name LIKE 'test/#sql-%';
TABLE_ID NAME FLAG N_COLS SPACE FILE_FORMAT ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE TABLE_ID NAME FLAG N_COLS SPACE FILE_FORMAT ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE
# Drop the orphaned rebuilt table.
SHOW TABLES; SHOW TABLES;
Tables_in_test Tables_in_test
t2 t2
...@@ -123,7 +122,6 @@ ERROR HY000: Lost connection to MySQL server during query ...@@ -123,7 +122,6 @@ ERROR HY000: Lost connection to MySQL server during query
SELECT * FROM information_schema.innodb_sys_tables SELECT * FROM information_schema.innodb_sys_tables
WHERE table_id = ID; WHERE table_id = ID;
TABLE_ID NAME FLAG N_COLS SPACE FILE_FORMAT ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE TABLE_ID NAME FLAG N_COLS SPACE FILE_FORMAT ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE
FLUSH TABLES;
# Files in datadir after manual recovery. # Files in datadir after manual recovery.
t1.frm t1.frm
t1.ibd t1.ibd
......
...@@ -72,9 +72,6 @@ let $orig_table_id = `SELECT table_id ...@@ -72,9 +72,6 @@ let $orig_table_id = `SELECT table_id
--error 2013 --error 2013
ALTER TABLE t1 ADD PRIMARY KEY (f2, f1); ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
--echo # Restart mysqld after the crash and reconnect.
--source include/start_mysqld.inc
let TABLENAME_INC= $MYSQLTEST_VARDIR/tmp/tablename.inc; let TABLENAME_INC= $MYSQLTEST_VARDIR/tmp/tablename.inc;
perl; perl;
die unless open OUT, ">$ENV{TABLENAME_INC}"; die unless open OUT, ">$ENV{TABLENAME_INC}";
...@@ -86,12 +83,15 @@ EOF ...@@ -86,12 +83,15 @@ EOF
source $TABLENAME_INC; source $TABLENAME_INC;
remove_file $TABLENAME_INC; remove_file $TABLENAME_INC;
move_file $datadir/test/$tablename.frm $datadir/test/t1.frm;
--echo # Restart mysqld after the crash and reconnect.
--source include/start_mysqld.inc
--replace_result $orig_table_id ID --replace_result $orig_table_id ID
eval SELECT * FROM information_schema.innodb_sys_tables eval SELECT * FROM information_schema.innodb_sys_tables
WHERE table_id = $orig_table_id; WHERE table_id = $orig_table_id;
move_file $datadir/test/$tablename.frm $datadir/test/t1.frm;
--echo # Files in datadir after manual recovery. --echo # Files in datadir after manual recovery.
--list_files $MYSQLD_DATADIR/test --list_files $MYSQLD_DATADIR/test
...@@ -125,26 +125,13 @@ let $orig_table_id = `SELECT table_id ...@@ -125,26 +125,13 @@ let $orig_table_id = `SELECT table_id
--error 2013 --error 2013
ALTER TABLE t2 ADD PRIMARY KEY (f2, f1); ALTER TABLE t2 ADD PRIMARY KEY (f2, f1);
remove_files_wildcard $datadir/test #sql-*.frm;
--echo # Startup the server after the crash --echo # Startup the server after the crash
--source include/start_mysqld.inc --source include/start_mysqld.inc
SELECT * FROM information_schema.innodb_sys_tables SELECT * FROM information_schema.innodb_sys_tables
WHERE name LIKE 'test/#sql-ib%'; WHERE name LIKE 'test/#sql-%';
perl;
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 # Drop the orphaned rebuilt table.
--disable_query_log
eval DROP TABLE `#mysql50#$tablename`;
--enable_query_log
SHOW TABLES; SHOW TABLES;
INSERT INTO t2 VALUES (5,6),(7,8); INSERT INTO t2 VALUES (5,6),(7,8);
...@@ -180,13 +167,6 @@ let $orig_table_id = `select table_id from ...@@ -180,13 +167,6 @@ let $orig_table_id = `select table_id from
--error 2013 --error 2013
ALTER TABLE t1 ADD INDEX (b), CHANGE c d int, ALGORITHM=INPLACE; ALTER TABLE t1 ADD INDEX (b), CHANGE c d int, ALGORITHM=INPLACE;
--echo # Restart mysqld after the crash and reconnect.
--source include/start_mysqld.inc
--replace_result $orig_table_id ID
eval SELECT * FROM information_schema.innodb_sys_tables
WHERE table_id = $orig_table_id;
perl; perl;
die unless open OUT, ">$ENV{TABLENAME_INC}"; die unless open OUT, ">$ENV{TABLENAME_INC}";
chdir "$ENV{'datadir'}/test"; chdir "$ENV{'datadir'}/test";
...@@ -194,12 +174,17 @@ my @frm_file = map { substr($_, 0, -4) } glob "#sql-*.frm"; ...@@ -194,12 +174,17 @@ my @frm_file = map { substr($_, 0, -4) } glob "#sql-*.frm";
print OUT 'let $tablename=', $frm_file[0], ';'; print OUT 'let $tablename=', $frm_file[0], ';';
close OUT or die; close OUT or die;
EOF EOF
source $TABLENAME_INC; source $TABLENAME_INC;
remove_file $TABLENAME_INC; remove_file $TABLENAME_INC;
move_file $datadir/test/$tablename.frm $datadir/test/t1.frm; move_file $datadir/test/$tablename.frm $datadir/test/t1.frm;
FLUSH TABLES; --echo # Restart mysqld after the crash and reconnect.
--source include/start_mysqld.inc
--replace_result $orig_table_id ID
eval SELECT * FROM information_schema.innodb_sys_tables
WHERE table_id = $orig_table_id;
--echo # Files in datadir after manual recovery. --echo # Files in datadir after manual recovery.
--list_files $MYSQLD_DATADIR/test --list_files $MYSQLD_DATADIR/test
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment