mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
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.
This commit is contained in:
@@ -29,6 +29,9 @@ UPDATE t SET a=3 WHERE a=1;
|
|||||||
# Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED.
|
# Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED.
|
||||||
# In earlier versions, this would return the last committed version
|
# In earlier versions, this would return the last committed version
|
||||||
# (empty table)!
|
# (empty table)!
|
||||||
|
SHOW VARIABLES LIKE "innodb_read_only";
|
||||||
|
Variable_name Value
|
||||||
|
innodb_read_only ON
|
||||||
SELECT * FROM t;
|
SELECT * FROM t;
|
||||||
a
|
a
|
||||||
3
|
3
|
||||||
@@ -39,6 +42,8 @@ a
|
|||||||
SET GLOBAL innodb_max_purge_lag_wait=0;
|
SET GLOBAL innodb_max_purge_lag_wait=0;
|
||||||
INSERT INTO mysql.innodb_index_stats
|
INSERT INTO mysql.innodb_index_stats
|
||||||
SELECT * FROM mysql.innodb_index_stats LIMIT 0;
|
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
|
# restart
|
||||||
SELECT * FROM t;
|
SELECT * FROM t;
|
||||||
a
|
a
|
||||||
|
@@ -1,3 +1,11 @@
|
|||||||
|
# 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
|
# restart
|
||||||
CREATE TEMPORARY TABLE t1(f1 INT NOT NULL,
|
CREATE TEMPORARY TABLE t1(f1 INT NOT NULL,
|
||||||
f2 INT NOT NULL)ENGINE=InnoDB;
|
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 # Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED.
|
||||||
--echo # In earlier versions, this would return the last committed version
|
--echo # In earlier versions, this would return the last committed version
|
||||||
--echo # (empty table)!
|
--echo # (empty table)!
|
||||||
|
SHOW VARIABLES LIKE "innodb_read_only";
|
||||||
SELECT * FROM t;
|
SELECT * FROM t;
|
||||||
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||||
SELECT * FROM t;
|
SELECT * FROM t;
|
||||||
SET GLOBAL innodb_max_purge_lag_wait=0;
|
SET GLOBAL innodb_max_purge_lag_wait=0;
|
||||||
INSERT INTO mysql.innodb_index_stats
|
INSERT INTO mysql.innodb_index_stats
|
||||||
SELECT * FROM mysql.innodb_index_stats LIMIT 0;
|
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=
|
--let $restart_parameters=
|
||||||
--source include/restart_mysqld.inc
|
--source include/restart_mysqld.inc
|
||||||
SELECT * FROM t;
|
SELECT * FROM t;
|
||||||
|
@@ -1,6 +1,16 @@
|
|||||||
--source include/have_innodb.inc
|
--source include/have_innodb.inc
|
||||||
--source include/have_sequence.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
|
--source include/restart_mysqld.inc
|
||||||
CREATE TEMPORARY TABLE t1(f1 INT NOT NULL,
|
CREATE TEMPORARY TABLE t1(f1 INT NOT NULL,
|
||||||
f2 INT NOT NULL)ENGINE=InnoDB;
|
f2 INT NOT NULL)ENGINE=InnoDB;
|
||||||
|
@@ -18482,7 +18482,8 @@ static
|
|||||||
void
|
void
|
||||||
innodb_trunc_temp_space_update(THD*, st_mysql_sys_var*, void*, const void* save)
|
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;
|
return;
|
||||||
mysql_mutex_unlock(&LOCK_global_system_variables);
|
mysql_mutex_unlock(&LOCK_global_system_variables);
|
||||||
fsp_shrink_temp_space();
|
fsp_shrink_temp_space();
|
||||||
|
Reference in New Issue
Block a user