MDEV-33101 Server crashes when starting the server with...

MDEV-33101 Server crashes when starting the server with innodb-force-recovery=6 and enabling the innodb_truncate_temporary_tablespace_now variable

The issue is introduced by "MDEV-28699: Shrink temporary tablespaces
without restart". SRV_FORCE_NO_LOG_REDO forces server to read only mode
and we don't initialize temporary tablespace in read only mode.

solution: innodb_truncate_temporary_tablespace_now should be no-op in
read only mode.
parent 63fb478f
......@@ -29,6 +29,9 @@ UPDATE t SET a=3 WHERE a=1;
# Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED.
# In earlier versions, this would return the last committed version
# (empty table)!
SHOW VARIABLES LIKE "innodb_read_only";
Variable_name Value
innodb_read_only ON
SELECT * FROM t;
a
3
......@@ -39,6 +42,8 @@ a
SET GLOBAL innodb_max_purge_lag_wait=0;
INSERT INTO mysql.innodb_index_stats
SELECT * FROM mysql.innodb_index_stats LIMIT 0;
Test Temp tablespace truncate in read only mode
SET GLOBAL innodb_truncate_temporary_tablespace_now=1;
# restart
SELECT * FROM t;
a
......
# MDEV-33101 Server crashes when starting the server with
# innodb-force-recovery=6 and enabling the
# innodb_truncate_temporary_tablespace_now variable
# restart: --innodb-force-recovery=6
SHOW VARIABLES LIKE "innodb_read_only";
Variable_name Value
innodb_read_only ON
SET GLOBAL innodb_truncate_temporary_tablespace_now=1;
# restart
CREATE TEMPORARY TABLE t1(f1 INT NOT NULL,
f2 INT NOT NULL)ENGINE=InnoDB;
......
......@@ -35,12 +35,15 @@ UPDATE t SET a=3 WHERE a=1;
--echo # Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED.
--echo # In earlier versions, this would return the last committed version
--echo # (empty table)!
SHOW VARIABLES LIKE "innodb_read_only";
SELECT * FROM t;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t;
SET GLOBAL innodb_max_purge_lag_wait=0;
INSERT INTO mysql.innodb_index_stats
SELECT * FROM mysql.innodb_index_stats LIMIT 0;
--echo Test Temp tablespace truncate in read only mode
SET GLOBAL innodb_truncate_temporary_tablespace_now=1;
--let $restart_parameters=
--source include/restart_mysqld.inc
SELECT * FROM t;
......
--source include/have_innodb.inc
--source include/have_sequence.inc
--echo # MDEV-33101 Server crashes when starting the server with
--echo # innodb-force-recovery=6 and enabling the
--echo # innodb_truncate_temporary_tablespace_now variable
--let $restart_parameters=--innodb-force-recovery=6
--source include/restart_mysqld.inc
SHOW VARIABLES LIKE "innodb_read_only";
SET GLOBAL innodb_truncate_temporary_tablespace_now=1;
--let $restart_parameters=
--source include/restart_mysqld.inc
CREATE TEMPORARY TABLE t1(f1 INT NOT NULL,
f2 INT NOT NULL)ENGINE=InnoDB;
......
......@@ -18482,7 +18482,8 @@ static
void
innodb_trunc_temp_space_update(THD*, st_mysql_sys_var*, void*, const void* save)
{
if (!*static_cast<const my_bool*>(save))
/* Temp tablespace is not initialized in read only mode. */
if (!*static_cast<const my_bool*>(save) || srv_read_only_mode)
return;
mysql_mutex_unlock(&LOCK_global_system_variables);
fsp_shrink_temp_space();
......
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