1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

MDEV-41021 SET GLOBAL innodb_log_archive ignores read-only mode

log_t::set_archive(): Prevent a crash in log_t::header_rewrite()
by refusing the operation if the log is read-only.
This commit is contained in:
Marko Mäkelä
2026-09-10 10:13:28 +03:00
parent d8d2e3ca54
commit e30f2bd21e
3 changed files with 10 additions and 0 deletions

View File

@@ -50,6 +50,8 @@ ALTER TABLE mysql.innodb_table_stats ROW_FORMAT=COMPACT, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Running in read-only mode. Try ALGORITHM=COPY
TRUNCATE TABLE mysql.innodb_table_stats;
ERROR HY000: Table 'innodb_table_stats' is read only
SET GLOBAL innodb_log_archive=!@@GLOBAL.innodb_log_archive;
ERROR HY000: InnoDB is in read only mode
# restart: --innodb-log-recovery-start=0 --innodb-log-recovery-target=18446744073705357290
SELECT variable_name, variable_value FROM information_schema.global_status
WHERE variable_name LIKE 'INNODB_LSN%';

View File

@@ -148,6 +148,8 @@ DROP TABLE mysql.innodb_index_stats;
ALTER TABLE mysql.innodb_table_stats ROW_FORMAT=COMPACT, ALGORITHM=INPLACE;
--error ER_OPEN_AS_READONLY
TRUNCATE TABLE mysql.innodb_table_stats;
--error ER_INNODB_READ_ONLY
SET GLOBAL innodb_log_archive=!@@GLOBAL.innodb_log_archive;
--source include/shutdown_mysqld.inc
--move_file $DATADIR/ib_logfile0 $DATADIR/ib_ffffffffff803000.log

View File

@@ -767,6 +767,12 @@ void log_t::header_rewrite(my_bool archive) noexcept
@param thd SQL connection */
void log_t::set_archive(my_bool archive, THD *thd) noexcept
{
if (UNIV_UNLIKELY(recv_sys.rpo != 0))
{
my_error(ER_INNODB_READ_ONLY, MYF(0));
return;
}
thd_wait_begin(thd, THD_WAIT_DISKIO);
tpool::tpool_wait_begin();
lsn_t wait_lsn;