Details
-
New Feature
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
Description
MySQL 8.0 introduced a way to disable or enable the InnoDB redo log while the server is running. jeanfrancois.gagne has pointed out that this could make sense for speeding up some bulk operations, such as setting up a replica.
I believe that the most straightforward way to implement this would be to rely on the log resizing mechanism that was introduced in MDEV-27812. Instead of tying this to a simple SET GLOBAL parameter, I think that it would be beneficial to have some ALTER ENGINE or ALTER INSTANCE syntax that would allow several aspects of the redo log to be changed at the same time:
- enable or disable the redo log
- modify innodb_log_group_home_dir (the storage location of ib_logfile0
- modify innodb_encrypt_log and possible encryption parameters
- modify innodb_log_file_size (
MDEV-27812enabled SET GLOBAL for this).
The logic of online log resizing or log rebuild is straightforward.
- Create and allocate a new file ib_logfile101 that will be the new log file.
- Start replicating log to ib_logfile101.
- On the next log checkpoint (page cleaner batch) that advances the LSN beyond the start of ib_logfile101, make ib_logfile101 the main write-ahead log ib_logfile0.
For disabling or enabling the redo log, MySQL 8.0 uses the following syntax:
ALTER INSTANCE DISABLE INNODB REDO_LOG; |
ALTER INSTANCE ENABLE INNODB REDO_LOG; |
Because MariaDB makes use of multiple storage engines, I believe that an alternative syntax might be more appropriate:
ALTER ENGINE innodb log ... |
Disabling the write-ahead log would be special in the way that no ib_logfile0 would exist at all. We would continue to allocate LSN and possibly write log records to log_sys.buf, but the log "writes" would simply advance log_sys.write_lsn and log_sys.flushed_to_disk_lsn without accessing the non-existent file. During the time when no redo log exists, crash recovery would be refused by default, thanks to MDEV-27199. When the redo log is re-enabled, the ib_logfile101 would be ignored by recovery until it is renamed to ib_logfile0 as part of a log checkpoint.
Attachments
Issue Links
- relates to
-
MDEV-19747 Deprecate and ignore innodb_log_optimize_ddl
-
- Closed
-
-
MDEV-27199 Require ib_logfile0 to exist unless innodb_force_recovery=6
-
- Closed
-
-
MDEV-27812 Allow innodb_log_file_size to change without server restart
-
- Closed
-
-
MDEV-34672 Merge applicable InnoDB changes from MySQL 8.0.38 and 8.0.39
-
- Closed
-