From cc1363071a9e6759e59142f3103245a091eacecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 26 Jun 2024 08:23:54 +0300 Subject: [PATCH] MDEV-34455 innodb_read_only=ON fails to imply innodb_doublewrite=OFF innodb_doublewrite_update(): Disallow any change if srv_read_only_mode holds, that is, the server was started with innodb_read_only=ON or innodb_force_recovery=6. This fixes up commit 1122ac978e2e709ae17a19335cbf0e4e5b53ad01 (MDEV-33545). --- mysql-test/suite/innodb/r/alter_copy.result | 5 +++++ mysql-test/suite/innodb/t/alter_copy.test | 4 ++++ storage/innobase/handler/ha_innodb.cc | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/innodb/r/alter_copy.result b/mysql-test/suite/innodb/r/alter_copy.result index 72ae28e9652..f9151409a44 100644 --- a/mysql-test/suite/innodb/r/alter_copy.result +++ b/mysql-test/suite/innodb/r/alter_copy.result @@ -186,6 +186,11 @@ t1 CREATE TABLE `t1` ( CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK +SET GLOBAL innodb_doublewrite=ON; +SELECT @@GLOBAL.innodb_doublewrite "OFF expected"; +OFF expected +OFF +SET GLOBAL innodb_buf_flush_list_now=ON; # restart FTS_INDEX_1.ibd FTS_INDEX_2.ibd diff --git a/mysql-test/suite/innodb/t/alter_copy.test b/mysql-test/suite/innodb/t/alter_copy.test index 90f2171d10b..7592d6c37d6 100644 --- a/mysql-test/suite/innodb/t/alter_copy.test +++ b/mysql-test/suite/innodb/t/alter_copy.test @@ -87,6 +87,10 @@ SELECT * FROM t1 WHERE MATCH(b,c) AGAINST ('column'); SHOW CREATE TABLE t1; CHECK TABLE t1; +SET GLOBAL innodb_doublewrite=ON; +SELECT @@GLOBAL.innodb_doublewrite "OFF expected"; +SET GLOBAL innodb_buf_flush_list_now=ON; + --let $restart_parameters= --source include/restart_mysqld.inc --replace_regex /FTS_[0-9a-f]*_[0-9a-f]*/FTS/ diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 4458c6b95b1..d2ceb9d7308 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -18420,7 +18420,8 @@ static void innodb_data_file_write_through_update(THD *, st_mysql_sys_var*, static void innodb_doublewrite_update(THD *, st_mysql_sys_var*, void *, const void *save) { - fil_system.set_use_doublewrite(*static_cast(save)); + if (!srv_read_only_mode) + fil_system.set_use_doublewrite(*static_cast(save)); } static void innodb_log_file_size_update(THD *thd, st_mysql_sys_var*,