Skip to content

Commit 21f18bd

Browse files
MDEV-33341 innodb.undo_space_dblwr test case fails with Unknown Storage Engine InnoDB
Reason: ====== undo_space_dblwr test case fails if the first page of undo tablespace is not flushed before restart the server. While restarting the server, InnoDB fails to detect the first page of undo tablespace from doublewrite buffer. Fix: === Use "ib_log_checkpoint_avoid_hard" debug sync point to avoid checkpoint and make sure to flush the dirtied page before killing the server. innodb_make_page_dirty(): Fails to set srv_fil_make_page_dirty_debug variable.
1 parent 6914b78 commit 21f18bd

File tree

5 files changed

+19
-24
lines changed

5 files changed

+19
-24
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ Variable_name Value
44
innodb_doublewrite ON
55
create table t1(f1 int not null, f2 int not null)engine=innodb;
66
insert into t1 values (1, 1);
7-
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
8-
InnoDB 0 transactions not purged
9-
set GLOBAL innodb_log_checkpoint_now=1;
7+
SET GLOBAL innodb_fast_shutdown = 0;
8+
# restart: --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0
109
# Make the first page dirty for undo tablespace
1110
set global innodb_saved_page_number_debug = 0;
1211
set global innodb_fil_make_page_dirty_debug = 1;
13-
SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0;
14-
SET GLOBAL innodb_max_dirty_pages_pct=0.0;
12+
SET GLOBAL innodb_buf_flush_list_now = 1;
1513
# Kill the server
16-
# restart
14+
# restart: --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0
1715
FOUND 1 /Checksum mismatch in the first page of file/ in mysqld.1.err
1816
check table t1;
1917
Table Op Msg_type Msg_text

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,19 @@ show variables like 'innodb_doublewrite';
99
create table t1(f1 int not null, f2 int not null)engine=innodb;
1010
insert into t1 values (1, 1);
1111

12-
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
13-
--source include/wait_all_purged.inc
12+
# Slow shutdown and restart to make sure ibuf merge is finished
13+
SET GLOBAL innodb_fast_shutdown = 0;
14+
let $shutdown_timeout=;
15+
let $restart_parameters="--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0";
16+
--source include/restart_mysqld.inc
1417

15-
set GLOBAL innodb_log_checkpoint_now=1;
1618
--source ../include/no_checkpoint_start.inc
17-
1819
--echo # Make the first page dirty for undo tablespace
1920
set global innodb_saved_page_number_debug = 0;
2021
set global innodb_fil_make_page_dirty_debug = 1;
2122

22-
SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0;
23-
SET GLOBAL innodb_max_dirty_pages_pct=0.0;
23+
SET GLOBAL innodb_buf_flush_list_now = 1;
2424

25-
sleep 1;
2625
--let CLEANUP_IF_CHECKPOINT=drop table t1;
2726
--source ../include/no_checkpoint_end.inc
2827

mysql-test/suite/sys_vars/r/innodb_fil_make_page_dirty_debug_basic.result

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,4 @@ Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be
2222
set global innodb_saved_page_number_debug = 0;
2323
set global innodb_fil_make_page_dirty_debug = @space_id;
2424
drop table t1;
25-
# Must always be 0.
26-
SELECT @@global.innodb_fil_make_page_dirty_debug;
27-
@@global.innodb_fil_make_page_dirty_debug
28-
0
25+
set global innodb_fil_make_page_dirty_debug = 0;

mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,4 @@ set global innodb_saved_page_number_debug = 0;
2929
set global innodb_fil_make_page_dirty_debug = @space_id;
3030
drop table t1;
3131

32-
--echo # Must always be 0.
33-
SELECT @@global.innodb_fil_make_page_dirty_debug;
34-
32+
set global innodb_fil_make_page_dirty_debug = 0;

storage/innobase/handler/ha_innodb.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17553,6 +17553,7 @@ innodb_make_page_dirty(THD*, st_mysql_sys_var*, void*, const void* save)
1755317553
{
1755417554
mtr_t mtr;
1755517555
uint space_id = *static_cast<const uint*>(save);
17556+
srv_fil_make_page_dirty_debug= space_id;
1755617557
mysql_mutex_unlock(&LOCK_global_system_variables);
1755717558
fil_space_t* space = fil_space_t::get(space_id);
1755817559

@@ -18310,13 +18311,15 @@ buf_flush_list_now_set(THD*, st_mysql_sys_var*, void*, const void* save)
1831018311
return;
1831118312
const uint s= srv_fil_make_page_dirty_debug;
1831218313
mysql_mutex_unlock(&LOCK_global_system_variables);
18313-
if (s)
18314-
buf_flush_sync();
18315-
else
18314+
if (s == 0 || srv_is_undo_tablespace(s))
1831618315
{
18317-
while (buf_flush_list_space(fil_system.sys_space, nullptr));
18316+
fil_space_t *space= fil_system.sys_space;
18317+
if (s) { space= fil_space_get(s); }
18318+
while (buf_flush_list_space(space, nullptr));
1831818319
os_aio_wait_until_no_pending_writes();
1831918320
}
18321+
else
18322+
buf_flush_sync();
1832018323
mysql_mutex_lock(&LOCK_global_system_variables);
1832118324
}
1832218325

0 commit comments

Comments
 (0)