Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5
Description
MariaDB Server 10.2.2 disabled redo logging for certain ALTER TABLE operations. In MDEV-16809 (10.2.17, 10.3.9) a possibility to enable the redo logging was introduced, by SET GLOBAL innodb_log_optimize_ddl=OFF. By default, the redo logging remains disabled. Backup can be much slower if such non-logged ALTER TABLE are performed while mariabackup --backup is running.
MDEV-19738 in 10.5 will skip the InnoDB doublewrite buffer in some cases. But, this cannot be done safely if redo logging can be disabled during ALTER TABLE. Hence, to get full advantage of MDEV-19738, we should change the default value of innodb_log_optimize_ddl to OFF, and possibly deprecate and ignore this parameter altogether.
The reason why I would consider making innodb_log_optimize_ddl read-only is that with MDEV-19738, changing the setting at runtime soon before or after affected ALTER TABLE is not crash-safe if the server is killed during a page write. But on the other hand, for ‘persons who know what they are doing’, maybe we should allow the parameter to modified while the server is running. SET GLOBAL requires special privileges anyway.
Before changing the default value, we should find out how much the speed of ALTER TABLE operations is affected by the change. With innodb_log_optimize_ddl=OFF, the extra page flushing will be avoided, and the affected forms of ALTER TABLE should become durable solely via redo log. Page flushing for the ALTER TABLE should be a little faster, because the doublewrite buffer can be avoided.
The affected forms of ALTER TABLE are:
--echo # rebuilding a table and all its indexes
|
ALTER TABLE t1 FORCE, ALGORITHM=INPLACE, LOCK=SHARED; |
--echo # creating secondary indexes (one or several)
|
ALTER TABLE t1 ADD INDEX (b), ADD INDEX (c), ALGORITHM=INPLACE, LOCK=SHARED; |
I would like to know the performance of this kind of ALTER TABLE on larger tables, with both settings of innodb_log_optimize_ddl.
Attachments
Issue Links
- blocks
-
MDEV-12353 Efficient InnoDB redo log record format
-
- Closed
-
- relates to
-
MDEV-12353 Efficient InnoDB redo log record format
-
- Closed
-
-
MDEV-16791 mariabackup : allow consistent backup, in presence of concurrent DDL, also without --lock-ddl-per-table
-
- Closed
-
-
MDEV-19768 Mariabackup should write warning during backup if server does not have innodb_log_optimize_ddl=OFF set
-
- Open
-
-
MDEV-23720 Change innodb_log_optimize_ddl=OFF by default
-
- Closed
-
-
MDEV-36301 ALTER ENGINE INNODB LOG ...
-
- Open
-
-
MDEV-16809 Allow full redo logging for ALTER TABLE
-
- Closed
-
-
MDEV-17596 Assertion `block->page.flush_observer == __null || block->page.flush_observer == observer' failed in buf_flush_note_modification
-
- Closed
-
-
MDEV-19738 Doublewrite buffer is unnecessarily used for newly (re)initialized pages
-
- Closed
-
-
MDEV-20608 innodb_log_optimize_ddl=OFF may omit some redo log
-
- Closed
-
I executed this crude benchmark:
--source include/have_innodb.inc
--source include/have_sequence.inc
) ENGINE=InnoDB;
--enable_info
--disable_info
SHOW PROFILES;
UNLOCK TABLES;
The results:
Note: the "affected rows: 0" for a non-empty table means that native ALTER TABLE was used.
The time for rebuilding tables is much longer. In 10.5, we expect this to go down with the redo log format improvements (
MDEV-12353andMDEV-14425). Until then, maybe we should allow the parameter to be set while the server is running, so that users can take the risk and temporarily disable redo logging for large table-rebuilding ALTER operations.We should also keep in mind that thanks to
MDEV-11369and various subtasks ofMDEV-11424, many ALTER TABLE operations are instantaneous, and table rebuilds should not occur very often.I would be interested in seeing how much the innodb_dblwr_writes is reduced (and performance is improved) on generic DML workloads. Maybe it is enough justification to change the parameter to the safe default.