Commit cc5c0eda authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-33156 Crash on innodb_buf_flush_list_now=ON and innodb_force_recovery=6

srv_start(): Move a read only mode startup tweak from
innodb_init_params() to the correct location. Also if
innodb_force_recovery=6 we will disable the doublewrite buffer,
because InnoDB must run in read-only mode to prevent further corruption.

This change only affects debug checks. Whenever srv_read_only_mode holds,
the buf_pool.flush_list will be empty, that is, there will be no writes
of persistent InnoDB data pages.

Reviewed by: Thirunarayanan Balathandayuthapani
parent 3a3a4f04
......@@ -12,6 +12,7 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check Warning InnoDB: Index 'b' contains 990 entries, should be 1024.
test.t1 check error Corrupt
SET GLOBAL innodb_buf_flush_list_now=ON;
# restart
SET GLOBAL innodb_fast_shutdown=0;
# restart
......
......@@ -72,6 +72,7 @@ EOF
--replace_regex /contains \d+ entries/contains 990 entries/
check table t1;
SET GLOBAL innodb_buf_flush_list_now=ON;
--source include/shutdown_mysqld.inc
......
......@@ -3893,11 +3893,6 @@ static int innodb_init_params()
}
#endif
if (srv_read_only_mode) {
ib::info() << "Started in read only mode";
srv_use_doublewrite_buf = FALSE;
}
#ifdef LINUX_NATIVE_AIO
#elif !defined _WIN32
/* Currently native AIO is supported only on windows and linux
......
......@@ -1073,10 +1073,14 @@ dberr_t srv_start(bool create_new_db)
if (srv_force_recovery) {
ib::info() << "!!! innodb_force_recovery is set to "
<< srv_force_recovery << " !!!";
if (srv_force_recovery == SRV_FORCE_NO_LOG_REDO) {
srv_read_only_mode = true;
}
}
if (srv_force_recovery == SRV_FORCE_NO_LOG_REDO) {
srv_read_only_mode = true;
if (srv_read_only_mode) {
sql_print_information("InnoDB: Started in read only mode");
srv_use_doublewrite_buf = false;
}
high_level_read_only = srv_read_only_mode
......
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