Skip to content

Commit

Permalink
Clean up a few tests that kill the server.
Browse files Browse the repository at this point in the history
As noted in MDEV-8841, any test that kills the server must issue
FLUSH TABLES, so that tables of crash-unsafe storage engines will
not be corrupted. Consistently issue this statement after any
call mtr.add_suppression() calls.

Also, do not invoke shutdown_server directly, but use helpers instead.
  • Loading branch information
dr-m committed Jan 27, 2017
1 parent ea9caea commit 4e82aaa
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 75 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
call mtr.add_suppression("InnoDB: The total blob data length");
SET GLOBAL max_allowed_packet = 100*1024*1024;
# Connection big_packets:
CREATE TABLE t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB;
Expand All @@ -10,9 +9,7 @@ INSERT INTO t1 (a, b) VALUES (5, '5');
start transaction;
INSERT INTO t1 (a, b) VALUES (6, REPEAT('a', 20*1024*1024));
ERROR 42000: The size of BLOB/TEXT data inserted in one transaction is greater than 10% of redo log size. Increase the redo log size using innodb_log_file_size.
# Connection default:
# Quick shutdown and restart server
# Connection default:
# Kill and restart
SELECT a FROM t1;
a
1
Expand Down
3 changes: 1 addition & 2 deletions mysql-test/suite/innodb/r/innodb_bug59641.result
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
call mtr.add_suppression("Found 3 prepared XA transactions");
flush tables;
CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
COMMIT;
Expand All @@ -16,6 +14,7 @@ XA START '789';
UPDATE t SET b=4*a WHERE a=32;
XA END '789';
XA PREPARE '789';
# Kill and restart
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t;
a b
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/suite/innodb/r/xa_recovery.result
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ XA START 'x';
UPDATE t1 set a=2;
XA END 'x';
XA PREPARE 'x';
call mtr.add_suppression("Found 1 prepared XA transactions");
# Kill and restart
SELECT * FROM t1 LOCK IN SHARE MODE;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t1;
Expand Down
28 changes: 7 additions & 21 deletions mysql-test/suite/innodb/t/innodb_blob_unrecoverable_crash.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
--source include/not_crashrep.inc
--source include/have_innodb.inc

call mtr.add_suppression("InnoDB: The total blob data length");

let $old_max_allowed_packet = `select @@max_allowed_packet`;
SET GLOBAL max_allowed_packet = 100*1024*1024;

--disable_query_log
call mtr.add_suppression("InnoDB: The total blob data length");
FLUSH TABLES;
--enable_query_log

--echo # Connection big_packets:
connect(big_packets,localhost,root,,);
connection big_packets;
Expand All @@ -28,28 +30,12 @@ start transaction;
--error ER_TOO_BIG_ROWSIZE
INSERT INTO t1 (a, b) VALUES (6, REPEAT('a', 20*1024*1024));

--echo # Connection default:
connection default;

# We expect a restart.
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

--echo # Quick shutdown and restart server
--shutdown_server 0

# Wait for the server to come back up, and reconnect.
--enable_reconnect
--source include/wait_until_connected_again.inc

--echo # Connection default:
connection default;
--source include/kill_and_restart_mysqld.inc
disconnect big_packets;

# We should see (1,2,3,4,5) here.
SELECT a FROM t1;

# Clean up.
DROP TABLE t1;

--disable_query_log
eval set global max_allowed_packet = $old_max_allowed_packet;
--enable_query_log
31 changes: 6 additions & 25 deletions mysql-test/suite/innodb/t/innodb_bug59641.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# Bug #59641 Prepared XA transaction causes shutdown hang after a crash

-- source include/not_embedded.inc
# The server would issue this warning on restart.
call mtr.add_suppression("Found 3 prepared XA transactions");

# Close tables used by other tests (to not get crashed myisam tables)
flush tables;
--disable_query_log
call mtr.add_suppression("Found 3 prepared XA transactions");
FLUSH TABLES;
--enable_query_log

CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
Expand All @@ -17,7 +17,6 @@ XA END '123';
XA PREPARE '123';

CONNECT (con1,localhost,root,,);
CONNECTION con1;

XA START '456';
INSERT INTO t VALUES(3,47),(5,67);
Expand All @@ -26,38 +25,20 @@ XA END '456';
XA PREPARE '456';

CONNECT (con2,localhost,root,,);
CONNECTION con2;

XA START '789';
UPDATE t SET b=4*a WHERE a=32;
XA END '789';
XA PREPARE '789';

CONNECT (con3,localhost,root,,);
CONNECTION con3;

# Kill the server without sending a shutdown command
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server 0
-- source include/wait_until_disconnected.inc

# Restart the server.
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
--source include/kill_and_restart_mysqld.inc
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t;
COMMIT;

# Shut down the server. This would hang because of the bug.
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server
-- source include/wait_until_disconnected.inc

# Restart the server.
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
--source include/restart_mysqld.inc

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t;
Expand Down
15 changes: 8 additions & 7 deletions mysql-test/suite/innodb/t/log_file_size.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ if (`SELECT @@innodb_log_file_size = 1048576`) {
--skip Test requires innodb_log_file_size>1M.
}

--disable_query_log
call mtr.add_suppression("InnoDB: Resizing redo log");
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
call mtr.add_suppression("InnoDB: New log files created");
call mtr.add_suppression("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata files do not match the log sequence number [0-9]+ in the ib_logfiles");
FLUSH TABLES;
--enable_query_log

CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 VALUES (42);
Expand Down Expand Up @@ -176,12 +184,5 @@ let SEARCH_PATTERN= InnoDB: Renaming log file .*ib_logfile101 to .*ib_logfile0;
--let $restart_parameters=
--source include/start_mysqld.inc

--disable_query_log
call mtr.add_suppression("InnoDB: Resizing redo log");
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
call mtr.add_suppression("InnoDB: New log files created");
call mtr.add_suppression("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata files do not match the log sequence number [0-9]+ in the ib_logfiles");
--enable_query_log

SELECT * FROM t1;
DROP TABLE t1;
17 changes: 2 additions & 15 deletions mysql-test/suite/innodb/t/xa_recovery.test
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
if (`select plugin_auth_version <= "5.6.24" from information_schema.plugins where plugin_name='innodb'`)
{
--skip Not fixed in InnoDB as of 5.6.24 or earlier
}
--source include/have_innodb.inc
# Embedded server does not support restarting.
--source include/not_embedded.inc

# MDEV-8841 - close tables opened by previous tests,
# so they don't get marked crashed when the server gets crashed
--disable_query_log
call mtr.add_suppression("Found 1 prepared XA transactions");
FLUSH TABLES;
--enable_query_log

Expand All @@ -18,17 +15,7 @@ connect (con1,localhost,root);
XA START 'x'; UPDATE t1 set a=2; XA END 'x'; XA PREPARE 'x';
connection default;

call mtr.add_suppression("Found 1 prepared XA transactions");

# Kill and restart the server.
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server 0
-- source include/wait_until_disconnected.inc

-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
-- disable_reconnect
--source include/kill_and_restart_mysqld.inc

disconnect con1;
connect (con1,localhost,root);
Expand Down

0 comments on commit 4e82aaa

Please sign in to comment.