[MDEV-19747] Deprecate and ignore innodb_log_optimize_ddl Created: 2019-06-13 Updated: 2023-11-27 Resolved: 2020-02-12 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | mariabackup, Storage Engine - InnoDB |
| Affects Version/s: | 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.5.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | ddl, deprecated_feature, performance | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
MariaDB Server 10.2.2 disabled redo logging for certain ALTER TABLE operations. In
The reason why I would consider making innodb_log_optimize_ddl read-only is that with 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:
I would like to know the performance of this kind of ALTER TABLE on larger tables, with both settings of innodb_log_optimize_ddl. |
| Comments |
| Comment by Marko Mäkelä [ 2019-06-13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I executed this crude benchmark:
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 ( We should also keep in mind that thanks to 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. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-09-17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I plan to deprecate and ignore the parameter innodb_log_optimize_ddl=OFF as part of the | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-02-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I repeated the microbenchmark after implementing some optimization for I amended the test case with a few reads of innodb_lsn_current (log_sys.lsn):
The execution time with the original settings
did not change much. However, the default redo log size must be so small that it is forcing page flushes. Let us fix that:
This will shrink the test time as follows:
I also collected statistics on the redo log bytes written:
So, it looks like with a reasonably large innodb_log_file_size, setting innodb_log_file_size=OFF may slightly improve performance. In | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-02-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Given that there does not appear to be any performance regression when using a reasonably sized redo log file, I think that we can go one step further and deprecate and ignore the parameter. In | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-04-23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I ran a bigger benchmark, with 10× the rows (seq_1_to_1000000) and the data directory on PCIe NVMe:
Before ADD INDEX, the t1.ibd file size is 2.5 GiB, and before the FORCE it is 3.3GiB. The tested revisions were as follows:
Even with a larger test, we can observe that innodb_log_optimize_ddl=0 (reverting the change in MySQL 5.7 to write less log on ALTER TABLE) is actually reducing performance, when the redo log file is reasonably large. The reason for this ought to be the extra flushing of the buffer pool right before the redo logging is re-enabled. The variable innodb_lsn_current is not available before 10.5. On 10.5, I tried one more variant: performing FORCE, ALGORITHM=COPY as the last step. That should write roughly the same amount of pages, but the pre-sorting of index records will be disabled.
Only the last step should differ. The first two steps are identical, but there is minor fluctuation, likely due to purge ( Conclusion: 10.5 with a properly configured redo log file size is faster than 10.4, and that innodb_log_optimize_ddl=0 (disabling the supposed optimization that was introduced in MySQL 5.7 and inherited to MariaDB 10.2.2) is likely improving performance in MariaDB Server 10.2, 10.3, and 10.4. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-04-23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I accidentally ran the 10.5 benchmark on /dev/shm instead of NVMe (ext4fs). For a true apples-to-apples comparison, here are the tables with updated numbers for 10.5:
For ADD INDEX, 10.5 is clearly slower than 10.4 with innodb_log_optimize_ddl=0. This might be improved by reducing the log volume of PageBulk::finishPage(). Here is the comparison between FORCE and ALGORITHM=COPY again, on NVMe instead of RAM disk:
|