Skip to content

Commit 2d6719d

Browse files
committed
MDEV-19514 preparation: Extend innodb.innodb-change-buffer-recovery
Test innodb_read_only startup (which will be refused after a crash), and test also innodb_force_recovery=5, and extract some change buffer merge statistics. Omit any statistics about delete (purge) buffering, because purge could happen at any time. Use the sequence storage engine for populating the table.
1 parent 23d6754 commit 2d6719d

File tree

3 files changed

+46
-32
lines changed

3 files changed

+46
-32
lines changed

mysql-test/suite/innodb/r/innodb-change-buffer-recovery.result

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,18 @@
22
# Bug#69122 - INNODB DOESN'T REDO-LOG INSERT BUFFER MERGE
33
# OPERATION IF IT IS DONE IN-PLACE
44
#
5+
call mtr.add_suppression("InnoDB: innodb_read_only prevents crash recovery");
6+
call mtr.add_suppression("Plugin initialization aborted at srv0start\\.cc");
7+
call mtr.add_suppression("Plugin 'InnoDB'");
8+
FLUSH TABLES;
59
CREATE TABLE t1(
610
a INT AUTO_INCREMENT PRIMARY KEY,
711
b CHAR(1),
812
c INT,
913
INDEX(b))
1014
ENGINE=InnoDB STATS_PERSISTENT=0;
1115
SET GLOBAL innodb_change_buffering_debug = 1;
12-
INSERT INTO t1 VALUES(0,'x',1);
13-
INSERT INTO t1 SELECT 0,b,c FROM t1;
14-
INSERT INTO t1 SELECT 0,b,c FROM t1;
15-
INSERT INTO t1 SELECT 0,b,c FROM t1;
16-
INSERT INTO t1 SELECT 0,b,c FROM t1;
17-
INSERT INTO t1 SELECT 0,b,c FROM t1;
18-
INSERT INTO t1 SELECT 0,b,c FROM t1;
19-
INSERT INTO t1 SELECT 0,b,c FROM t1;
20-
INSERT INTO t1 SELECT 0,b,c FROM t1;
21-
INSERT INTO t1 SELECT 0,b,c FROM t1;
22-
INSERT INTO t1 SELECT 0,b,c FROM t1;
23-
INSERT INTO t1 SELECT 0,b,c FROM t1;
24-
INSERT INTO t1 SELECT 0,b,c FROM t1;
25-
INSERT INTO t1 SELECT 0,b,c FROM t1;
16+
INSERT INTO t1 SELECT 0,'x',1 FROM seq_1_to_8192;
2617
BEGIN;
2718
SELECT b FROM t1 LIMIT 3;
2819
b
@@ -38,8 +29,23 @@ SELECT b FROM t1 LIMIT 3;
3829
ERROR HY000: Lost connection to MySQL server during query
3930
disconnect con1;
4031
connection default;
41-
FOUND 1 /Wrote log record for ibuf update in place operation/ in my_restart.err
32+
FOUND 1 /Wrote log record for ibuf update in place operation/ in mysqld.1.err
33+
CHECK TABLE t1;
34+
Table Op Msg_type Msg_text
35+
test.t1 check Error Unknown storage engine 'InnoDB'
36+
test.t1 check error Corrupt
37+
FOUND 1 /innodb_read_only prevents crash recovery/ in mysqld.1.err
38+
SELECT * FROM t1 LIMIT 1;
39+
a b c
40+
1 X 1
41+
SHOW ENGINE INNODB STATUS;
42+
Type Name Status
43+
InnoDB insert 0, delete mark 0
44+
SET GLOBAL innodb_fast_shutdown=0;
4245
CHECK TABLE t1;
4346
Table Op Msg_type Msg_text
4447
test.t1 check status OK
48+
SHOW ENGINE INNODB STATUS;
49+
Type Name Status
50+
InnoDB insert 79, delete mark 1
4551
DROP TABLE t1;
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
--log-error=$MYSQLTEST_VARDIR/tmp/my_restart.err
21
--innodb_buffer_pool_size=24M

mysql-test/suite/innodb/t/innodb-change-buffer-recovery.test

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
--source include/not_valgrind.inc
1212
# This test is slow on buildbot.
1313
--source include/big_test.inc
14+
--source include/have_sequence.inc
15+
16+
call mtr.add_suppression("InnoDB: innodb_read_only prevents crash recovery");
17+
call mtr.add_suppression("Plugin initialization aborted at srv0start\\.cc");
18+
call mtr.add_suppression("Plugin 'InnoDB'");
19+
FLUSH TABLES;
1420

1521
CREATE TABLE t1(
1622
a INT AUTO_INCREMENT PRIMARY KEY,
@@ -27,25 +33,12 @@ ENGINE=InnoDB STATS_PERSISTENT=0;
2733
# change buffering is possible, so that the change buffer will be used
2834
# whenever possible.
2935
SET GLOBAL innodb_change_buffering_debug = 1;
30-
let SEARCH_FILE = $MYSQLTEST_VARDIR/tmp/my_restart.err;
36+
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
3137

3238
# Create enough rows for the table, so that the change buffer will be
3339
# used for modifying the secondary index page. There must be multiple
3440
# index pages, because changes to the root page are never buffered.
35-
INSERT INTO t1 VALUES(0,'x',1);
36-
INSERT INTO t1 SELECT 0,b,c FROM t1;
37-
INSERT INTO t1 SELECT 0,b,c FROM t1;
38-
INSERT INTO t1 SELECT 0,b,c FROM t1;
39-
INSERT INTO t1 SELECT 0,b,c FROM t1;
40-
INSERT INTO t1 SELECT 0,b,c FROM t1;
41-
INSERT INTO t1 SELECT 0,b,c FROM t1;
42-
INSERT INTO t1 SELECT 0,b,c FROM t1;
43-
INSERT INTO t1 SELECT 0,b,c FROM t1;
44-
INSERT INTO t1 SELECT 0,b,c FROM t1;
45-
INSERT INTO t1 SELECT 0,b,c FROM t1;
46-
INSERT INTO t1 SELECT 0,b,c FROM t1;
47-
INSERT INTO t1 SELECT 0,b,c FROM t1;
48-
INSERT INTO t1 SELECT 0,b,c FROM t1;
41+
INSERT INTO t1 SELECT 0,'x',1 FROM seq_1_to_8192;
4942

5043
BEGIN;
5144
SELECT b FROM t1 LIMIT 3;
@@ -63,10 +56,26 @@ SET DEBUG_DBUG='+d,crash_after_log_ibuf_upd_inplace';
6356
SELECT b FROM t1 LIMIT 3;
6457
disconnect con1;
6558
connection default;
66-
6759
let SEARCH_PATTERN=Wrote log record for ibuf update in place operation;
6860
--source include/search_pattern_in_file.inc
61+
62+
--let $restart_parameters= --innodb-read-only
6963
--source include/start_mysqld.inc
64+
CHECK TABLE t1;
65+
--source include/shutdown_mysqld.inc
66+
let SEARCH_PATTERN=innodb_read_only prevents crash recovery;
67+
--source include/search_pattern_in_file.inc
7068

69+
--let $restart_parameters= --innodb-force-recovery=5
70+
--source include/start_mysqld.inc
71+
SELECT * FROM t1 LIMIT 1;
72+
replace_regex /.*operations:.* (insert.*), delete \d.*discarded .*/\1/;
73+
SHOW ENGINE INNODB STATUS;
74+
# Slow shutdown will not merge the changes due to innodb_force_recovery=5.
75+
SET GLOBAL innodb_fast_shutdown=0;
76+
--let $restart_parameters=
77+
--source include/restart_mysqld.inc
7178
CHECK TABLE t1;
79+
replace_regex /.*operations:.* (insert.*), delete \d.*discarded .*/\1/;
80+
SHOW ENGINE INNODB STATUS;
7281
DROP TABLE t1;

0 commit comments

Comments
 (0)