Skip to content

Commit 4e82aaa

Browse files
committed
Clean up a few tests that kill the server.
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.
1 parent ea9caea commit 4e82aaa

File tree

7 files changed

+26
-75
lines changed

7 files changed

+26
-75
lines changed

mysql-test/suite/innodb/r/innodb_blob_unrecoverable_crash.result

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
call mtr.add_suppression("InnoDB: The total blob data length");
21
SET GLOBAL max_allowed_packet = 100*1024*1024;
32
# Connection big_packets:
43
CREATE TABLE t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB;
@@ -10,9 +9,7 @@ INSERT INTO t1 (a, b) VALUES (5, '5');
109
start transaction;
1110
INSERT INTO t1 (a, b) VALUES (6, REPEAT('a', 20*1024*1024));
1211
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.
13-
# Connection default:
14-
# Quick shutdown and restart server
15-
# Connection default:
12+
# Kill and restart
1613
SELECT a FROM t1;
1714
a
1815
1

mysql-test/suite/innodb/r/innodb_bug59641.result

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
call mtr.add_suppression("Found 3 prepared XA transactions");
2-
flush tables;
31
CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
42
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
53
COMMIT;
@@ -16,6 +14,7 @@ XA START '789';
1614
UPDATE t SET b=4*a WHERE a=32;
1715
XA END '789';
1816
XA PREPARE '789';
17+
# Kill and restart
1918
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
2019
SELECT * FROM t;
2120
a b

mysql-test/suite/innodb/r/xa_recovery.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ XA START 'x';
44
UPDATE t1 set a=2;
55
XA END 'x';
66
XA PREPARE 'x';
7-
call mtr.add_suppression("Found 1 prepared XA transactions");
7+
# Kill and restart
88
SELECT * FROM t1 LOCK IN SHARE MODE;
99
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
1010
SELECT * FROM t1;

mysql-test/suite/innodb/t/innodb_blob_unrecoverable_crash.test

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
--source include/not_crashrep.inc
33
--source include/have_innodb.inc
44

5-
call mtr.add_suppression("InnoDB: The total blob data length");
6-
7-
let $old_max_allowed_packet = `select @@max_allowed_packet`;
85
SET GLOBAL max_allowed_packet = 100*1024*1024;
96

7+
--disable_query_log
8+
call mtr.add_suppression("InnoDB: The total blob data length");
9+
FLUSH TABLES;
10+
--enable_query_log
11+
1012
--echo # Connection big_packets:
1113
connect(big_packets,localhost,root,,);
1214
connection big_packets;
@@ -28,28 +30,12 @@ start transaction;
2830
--error ER_TOO_BIG_ROWSIZE
2931
INSERT INTO t1 (a, b) VALUES (6, REPEAT('a', 20*1024*1024));
3032

31-
--echo # Connection default:
32-
connection default;
33-
34-
# We expect a restart.
35-
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
36-
37-
--echo # Quick shutdown and restart server
38-
--shutdown_server 0
39-
40-
# Wait for the server to come back up, and reconnect.
41-
--enable_reconnect
42-
--source include/wait_until_connected_again.inc
43-
44-
--echo # Connection default:
4533
connection default;
34+
--source include/kill_and_restart_mysqld.inc
35+
disconnect big_packets;
4636

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

5040
# Clean up.
5141
DROP TABLE t1;
52-
53-
--disable_query_log
54-
eval set global max_allowed_packet = $old_max_allowed_packet;
55-
--enable_query_log

mysql-test/suite/innodb/t/innodb_bug59641.test

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
# Bug #59641 Prepared XA transaction causes shutdown hang after a crash
33

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

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

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

1919
CONNECT (con1,localhost,root,,);
20-
CONNECTION con1;
2120

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

2827
CONNECT (con2,localhost,root,,);
29-
CONNECTION con2;
3028

3129
XA START '789';
3230
UPDATE t SET b=4*a WHERE a=32;
3331
XA END '789';
3432
XA PREPARE '789';
3533

3634
CONNECT (con3,localhost,root,,);
37-
CONNECTION con3;
3835

39-
# Kill the server without sending a shutdown command
40-
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
41-
-- shutdown_server 0
42-
-- source include/wait_until_disconnected.inc
43-
44-
# Restart the server.
45-
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
46-
-- enable_reconnect
47-
-- source include/wait_until_connected_again.inc
36+
--source include/kill_and_restart_mysqld.inc
4837
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
4938
SELECT * FROM t;
5039
COMMIT;
5140

52-
# Shut down the server. This would hang because of the bug.
53-
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
54-
-- shutdown_server
55-
-- source include/wait_until_disconnected.inc
56-
57-
# Restart the server.
58-
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
59-
-- enable_reconnect
60-
-- source include/wait_until_connected_again.inc
41+
--source include/restart_mysqld.inc
6142

6243
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
6344
SELECT * FROM t;

mysql-test/suite/innodb/t/log_file_size.test

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ if (`SELECT @@innodb_log_file_size = 1048576`) {
1313
--skip Test requires innodb_log_file_size>1M.
1414
}
1515

16+
--disable_query_log
17+
call mtr.add_suppression("InnoDB: Resizing redo log");
18+
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
19+
call mtr.add_suppression("InnoDB: New log files created");
20+
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");
21+
FLUSH TABLES;
22+
--enable_query_log
23+
1624
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
1725
BEGIN;
1826
INSERT INTO t1 VALUES (42);
@@ -176,12 +184,5 @@ let SEARCH_PATTERN= InnoDB: Renaming log file .*ib_logfile101 to .*ib_logfile0;
176184
--let $restart_parameters=
177185
--source include/start_mysqld.inc
178186

179-
--disable_query_log
180-
call mtr.add_suppression("InnoDB: Resizing redo log");
181-
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
182-
call mtr.add_suppression("InnoDB: New log files created");
183-
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");
184-
--enable_query_log
185-
186187
SELECT * FROM t1;
187188
DROP TABLE t1;

mysql-test/suite/innodb/t/xa_recovery.test

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
if (`select plugin_auth_version <= "5.6.24" from information_schema.plugins where plugin_name='innodb'`)
2-
{
3-
--skip Not fixed in InnoDB as of 5.6.24 or earlier
4-
}
51
--source include/have_innodb.inc
62
# Embedded server does not support restarting.
73
--source include/not_embedded.inc
84

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

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

21-
call mtr.add_suppression("Found 1 prepared XA transactions");
22-
23-
# Kill and restart the server.
24-
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
25-
-- shutdown_server 0
26-
-- source include/wait_until_disconnected.inc
27-
28-
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
29-
-- enable_reconnect
30-
-- source include/wait_until_connected_again.inc
31-
-- disable_reconnect
18+
--source include/kill_and_restart_mysqld.inc
3219

3320
disconnect con1;
3421
connect (con1,localhost,root);

0 commit comments

Comments
 (0)