Adjust the tests for MariaDB.

New added test case: alter_kill in innodb suite.
parent ac2410f6
...@@ -3,9 +3,12 @@ ...@@ -3,9 +3,12 @@
# #
SET GLOBAL innodb_file_per_table=1; SET GLOBAL innodb_file_per_table=1;
CREATE TABLE bug16720368_1 (a INT PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE bug16720368_1 (a INT PRIMARY KEY) ENGINE=InnoDB;
connect con1,localhost,root;
CREATE TABLE bug16720368 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; CREATE TABLE bug16720368 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO bug16720368 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8); INSERT INTO bug16720368 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8);
connection default;
# Cleanly shutdown mysqld # Cleanly shutdown mysqld
disconnect con1;
# Corrupt FIL_PAGE_OFFSET in bug16720368.ibd, # Corrupt FIL_PAGE_OFFSET in bug16720368.ibd,
# and update the checksum to the "don't care" value. # and update the checksum to the "don't care" value.
# Restart mysqld # Restart mysqld
...@@ -15,22 +18,17 @@ SELECT COUNT(*) FROM bug16720368; ...@@ -15,22 +18,17 @@ SELECT COUNT(*) FROM bug16720368;
COUNT(*) COUNT(*)
8 8
INSERT INTO bug16720368_1 VALUES(1); INSERT INTO bug16720368_1 VALUES(1);
# Kill the server to do an unclean shutdown.
# The corruption should not prevent startup after crash recovery,
# because there is no redo log for the corrupted tablespace.
# The table is unaccessible, because after a crash we will # The table is unaccessible, because after a crash we will
# validate the tablespace header. # validate the tablespace header.
SELECT COUNT(*) FROM bug16720368; SELECT COUNT(*) FROM bug16720368;
ERROR 42S02: Table 'test.bug16720368' doesn't exist ERROR 42S02: Table 'test.bug16720368' doesn't exist in engine
INSERT INTO bug16720368 VALUES(0,1); INSERT INTO bug16720368 VALUES(0,1);
ERROR 42S02: Table 'test.bug16720368' doesn't exist ERROR 42S02: Table 'test.bug16720368' doesn't exist in engine
# Kill the server to do an unclean shutdown.
# The table is readable thanks to innodb-force-recovery. # The table is readable thanks to innodb-force-recovery.
SELECT COUNT(*) FROM bug16720368; SELECT COUNT(*) FROM bug16720368;
COUNT(*) COUNT(*)
8 8
INSERT INTO bug16720368 VALUES(0,1); INSERT INTO bug16720368 VALUES(0,1);
ERROR HY000: Operation not allowed when innodb_forced_recovery > 0.
# Shut down the server cleanly to hide the corruption. # Shut down the server cleanly to hide the corruption.
# The table is accessible, because after a clean shutdown we will # The table is accessible, because after a clean shutdown we will
# NOT validate the tablespace header. # NOT validate the tablespace header.
...@@ -38,8 +36,7 @@ ERROR HY000: Operation not allowed when innodb_forced_recovery > 0. ...@@ -38,8 +36,7 @@ ERROR HY000: Operation not allowed when innodb_forced_recovery > 0.
# any pages, because that would hit the corruption on page 0. # any pages, because that would hit the corruption on page 0.
SELECT COUNT(*) FROM bug16720368; SELECT COUNT(*) FROM bug16720368;
COUNT(*) COUNT(*)
8 9
INSERT INTO bug16720368 VALUES(0,1);
# Shut down the server to uncorrupt the data. # Shut down the server to uncorrupt the data.
# Restart the server after uncorrupting the file. # Restart the server after uncorrupting the file.
INSERT INTO bug16720368 VALUES(9,1); INSERT INTO bug16720368 VALUES(9,1);
...@@ -55,12 +52,17 @@ SET GLOBAL innodb_file_per_table=1; ...@@ -55,12 +52,17 @@ SET GLOBAL innodb_file_per_table=1;
CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
BEGIN; BEGIN;
INSERT INTO t1 VALUES(42); INSERT INTO t1 VALUES(42);
connect con1,localhost,root;
CREATE TABLE bug16735660 (a INT PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE bug16735660 (a INT PRIMARY KEY) ENGINE=InnoDB;
XA START 'x'; XA START 'x';
INSERT INTO bug16735660 VALUES(1),(2),(3); INSERT INTO bug16735660 VALUES(1),(2),(3);
XA END 'x'; XA END 'x';
XA PREPARE 'x'; XA PREPARE 'x';
connection default;
# Kill the server
disconnect con1;
# Attempt to start without an *.ibd file. # Attempt to start without an *.ibd file.
FOUND 1 /\[ERROR\] InnoDB: Tablespace [0-9]+ was not found at .*test.bug16735660.ibd/ in mysqld.1.err
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM bug16735660; SELECT * FROM bug16735660;
a a
......
--source include/have_innodb.inc
# The embedded server does not support restarting in mysql-test-run. # The embedded server does not support restarting in mysql-test-run.
-- source include/not_embedded.inc -- source include/not_embedded.inc
-- source include/no_valgrind_without_big.inc
let MYSQLD_DATADIR=`select @@datadir`; let MYSQLD_DATADIR=`select @@datadir`;
let PAGE_SIZE=`select @@innodb_page_size`; let PAGE_SIZE=`select @@innodb_page_size`;
-- disable_query_log -- disable_query_log
call mtr.add_suppression("InnoDB: innodb_force_recovery is on."); call mtr.add_suppression("InnoDB: innodb_force_recovery is on.");
call mtr.add_suppression("InnoDB: Tablespace open failed for.*bug16720368"); call mtr.add_suppression("InnoDB: Header page contains inconsistent data in .*bug16720368.ibd");
call mtr.add_suppression("InnoDB: Failed to find tablespace.*bug16720368"); call mtr.add_suppression("InnoDB: Checksum mismatch in datafile:.*bug16720368");
call mtr.add_suppression("InnoDB:.*inconsistent data.*test/bug16720368"); call mtr.add_suppression("InnoDB: Ignoring tablespace for.*bug16720368");
call mtr.add_suppression("InnoDB: Could not find.*test/bug16720368");
call mtr.add_suppression("Found 1 prepared XA transactions"); call mtr.add_suppression("Found 1 prepared XA transactions");
call mtr.add_suppression("InnoDB: .*test.*bug16720368.*missing");
call mtr.add_suppression("InnoDB: Operating system error.*in a file operation"); call mtr.add_suppression("InnoDB: Operating system error.*in a file operation");
call mtr.add_suppression("InnoDB: \(The error means\|If you are\)"); call mtr.add_suppression("InnoDB: \(The error means\|If you are\)");
call mtr.add_suppression("InnoDB: Ignoring tablespace `test/bug16720368` because it could not be opened");
call mtr.add_suppression("InnoDB: Tablespace .* was not found at.*bug16735660");
call mtr.add_suppression("InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace.");
call mtr.add_suppression("InnoDB: Plugin initialization aborted*");
call mtr.add_suppression("Plugin 'InnoDB' init function returned error.");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed.");
-- enable_query_log -- enable_query_log
-- echo # -- echo #
...@@ -55,38 +61,27 @@ SELECT COUNT(*) FROM bug16720368; ...@@ -55,38 +61,27 @@ SELECT COUNT(*) FROM bug16720368;
INSERT INTO bug16720368_1 VALUES(1); INSERT INTO bug16720368_1 VALUES(1);
-- echo # Kill the server to do an unclean shutdown. --let $shutdown_timeout= 0
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/restart_mysqld.inc
-- shutdown_server 0
-- source include/wait_until_disconnected.inc
-- echo # The corruption should not prevent startup after crash recovery,
-- echo # because there is no redo log for the corrupted tablespace.
-- source include/start_mysqld.inc
-- echo # The table is unaccessible, because after a crash we will -- echo # The table is unaccessible, because after a crash we will
-- echo # validate the tablespace header. -- echo # validate the tablespace header.
--error ER_NO_SUCH_TABLE --error ER_NO_SUCH_TABLE_IN_ENGINE
SELECT COUNT(*) FROM bug16720368; SELECT COUNT(*) FROM bug16720368;
--error ER_NO_SUCH_TABLE --error ER_NO_SUCH_TABLE_IN_ENGINE
INSERT INTO bug16720368 VALUES(0,1); INSERT INTO bug16720368 VALUES(0,1);
-- echo # Kill the server to do an unclean shutdown. let $restart_parameters = --innodb-force-recovery=3;
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --let $shutdown_timeout= 0
-- shutdown_server 0 --source include/restart_mysqld.inc
-- source include/wait_until_disconnected.inc
-- exec echo "restart: --innodb-force-recovery=3" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
-- disable_reconnect
-- echo # The table is readable thanks to innodb-force-recovery. -- echo # The table is readable thanks to innodb-force-recovery.
SELECT COUNT(*) FROM bug16720368; SELECT COUNT(*) FROM bug16720368;
--error ER_INNODB_FORCED_RECOVERY
INSERT INTO bug16720368 VALUES(0,1); INSERT INTO bug16720368 VALUES(0,1);
-- echo # Shut down the server cleanly to hide the corruption. -- echo # Shut down the server cleanly to hide the corruption.
let $shutdown_timeout=;
let $restart_parameters =;
-- source include/restart_mysqld.inc -- source include/restart_mysqld.inc
-- echo # The table is accessible, because after a clean shutdown we will -- echo # The table is accessible, because after a clean shutdown we will
...@@ -94,7 +89,6 @@ INSERT INTO bug16720368 VALUES(0,1); ...@@ -94,7 +89,6 @@ INSERT INTO bug16720368 VALUES(0,1);
-- echo # We can modify the existing pages, but we cannot allocate or free -- echo # We can modify the existing pages, but we cannot allocate or free
-- echo # any pages, because that would hit the corruption on page 0. -- echo # any pages, because that would hit the corruption on page 0.
SELECT COUNT(*) FROM bug16720368; SELECT COUNT(*) FROM bug16720368;
INSERT INTO bug16720368 VALUES(0,1);
-- echo # Shut down the server to uncorrupt the data. -- echo # Shut down the server to uncorrupt the data.
-- source include/shutdown_mysqld.inc -- source include/shutdown_mysqld.inc
...@@ -137,32 +131,22 @@ INSERT INTO bug16735660 VALUES(1),(2),(3); ...@@ -137,32 +131,22 @@ INSERT INTO bug16735660 VALUES(1),(2),(3);
XA END 'x'; XA END 'x';
XA PREPARE 'x'; XA PREPARE 'x';
-- connect (con2,localhost,root)
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server 0
-- source include/wait_until_disconnected.inc
-- disconnect con1
-- disconnect con2
-- connection default -- connection default
-- source include/kill_mysqld.inc
-- disconnect con1
-- move_file $MYSQLD_DATADIR/test/bug16735660.ibd $MYSQLD_DATADIR/bug16735660.omg -- move_file $MYSQLD_DATADIR/test/bug16735660.ibd $MYSQLD_DATADIR/bug16735660.omg
-- echo # Attempt to start without an *.ibd file. -- echo # Attempt to start without an *.ibd file.
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err; let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
-- error 1 --source include/start_mysqld.inc
-- exec $MYSQLD_CMD --console > $SEARCH_FILE 2>&1;
let SEARCH_PATTERN= \[ERROR\] InnoDB: Tablespace [0-9]+ was not found at \..test.bug16735660\.ibd\.; let SEARCH_PATTERN= \[ERROR\] InnoDB: Tablespace [0-9]+ was not found at .*test.bug16735660.ibd;
-- source include/search_pattern_in_file.inc -- source include/search_pattern_in_file.inc
-- move_file $MYSQLD_DATADIR/bug16735660.omg $MYSQLD_DATADIR/test/bug16735660.ibd -- move_file $MYSQLD_DATADIR/bug16735660.omg $MYSQLD_DATADIR/test/bug16735660.ibd
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -- source include/restart_mysqld.inc
-- enable_reconnect
-- source include/wait_until_connected_again.inc
-- disable_reconnect
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM bug16735660; SELECT * FROM bug16735660;
......
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