MDEV-34519 innodb_log_checkpoint_now crashes when innodb_read_only is enabled

During read only mode, InnoDB doesn't allow checkpoint to happen.
So InnoDB should throw the warning when InnoDB tries to
force the checkpoint when innodb_read_only = 1 or
innodb_force_recovery = 6.
parent 9e8546e2
......@@ -5,4 +5,17 @@ CREATE TABLE t1(f1 INT NOT NULL, f2 TEXT)ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, repeat('a', 4000) FROM seq_1_to_1800;
# restart: --debug_dbug=+d,before_final_redo_apply --innodb_log_file_size=8M
# restart: --innodb_log_file_size=10M
#
# MDEV-34519 innodb_log_checkpoint_now crashes when
# innodb_read_only is enabled
#
# restart: --innodb-force-recovery=6
SET GLOBAL innodb_log_checkpoint_now=1;
Warnings:
Warning 138 InnoDB doesn't force checkpoint when innodb-force-recovery=6.
# restart: --innodb-read-only=1
SET GLOBAL innodb_log_checkpoint_now=1;
Warnings:
Warning 138 InnoDB doesn't force checkpoint when innodb-read-only=1.
# restart
DROP TABLE t1;
......@@ -14,4 +14,18 @@ let $shutdown_timeout=0;
let $restart_parameters=--innodb_log_file_size=10M;
let $shutdown_timeout=;
--source include/restart_mysqld.inc
--echo #
--echo # MDEV-34519 innodb_log_checkpoint_now crashes when
--echo # innodb_read_only is enabled
--echo #
--let $restart_parameters=--innodb-force-recovery=6
--source include/restart_mysqld.inc
SET GLOBAL innodb_log_checkpoint_now=1;
--let $restart_parameters=--innodb-read-only=1
--source include/restart_mysqld.inc
SET GLOBAL innodb_log_checkpoint_now=1;
let $restart_parameters=;
--source include/restart_mysqld.inc
DROP TABLE t1;
......@@ -18378,28 +18378,42 @@ wait_background_drop_list_empty(THD*, st_mysql_sys_var*, void*, const void*)
Force innodb to checkpoint. */
static
void
checkpoint_now_set(THD*, st_mysql_sys_var*, void*, const void* save)
checkpoint_now_set(THD* thd, st_mysql_sys_var*, void*, const void* save)
{
if (*(my_bool*) save) {
mysql_mutex_unlock(&LOCK_global_system_variables);
if (!*(my_bool*) save) {
return;
}
lsn_t lsn;
if (srv_read_only_mode) {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
"InnoDB doesn't force checkpoint "
"when %s",
(srv_force_recovery
== SRV_FORCE_NO_LOG_REDO)
? "innodb-force-recovery=6."
: "innodb-read-only=1.");
return;
}
while (log_sys.last_checkpoint_lsn.load(
std::memory_order_acquire)
+ SIZE_OF_FILE_CHECKPOINT
+ log_sys.framing_size()
< (lsn= log_sys.get_lsn(std::memory_order_acquire))) {
log_make_checkpoint();
log_sys.log.flush();
}
mysql_mutex_unlock(&LOCK_global_system_variables);
if (dberr_t err = fil_write_flushed_lsn(lsn)) {
ib::warn() << "Checkpoint set failed " << err;
}
lsn_t lsn;
mysql_mutex_lock(&LOCK_global_system_variables);
while (log_sys.last_checkpoint_lsn.load(
std::memory_order_acquire)
+ SIZE_OF_FILE_CHECKPOINT
+ log_sys.framing_size()
< (lsn= log_sys.get_lsn(std::memory_order_acquire))) {
log_make_checkpoint();
log_sys.log.flush();
}
if (dberr_t err = fil_write_flushed_lsn(lsn)) {
ib::warn() << "Checkpoint set failed " << err;
}
mysql_mutex_lock(&LOCK_global_system_variables);
}
/****************************************************************//**
......
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