[MDEV-16809] Allow full redo logging for ALTER TABLE Created: 2018-07-24 Updated: 2022-04-26 Resolved: 2018-07-26 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.2.2, 10.3.0 |
| Fix Version/s: | 10.2.17, 10.3.9 |
| Type: | Bug | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | backup, ddl, performance | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
As part of WL#7277 in MySQL 5.7, redo logging was disabled during ALTER TABLE…ALGORITHM=INPLACE operations that rebuild the table or create indexes (other than spatial indexes). In Bug#21796691 INNODB REDO LOG DOES NOT INDICATE WHEN REDO LOGGING IS SKIPPED (MySQL 5.7.9, the first GA release) I introduced the redo log record MLOG_INDEX_LOAD for informing backup tools that the backup may be invalid. For deployments where ALTER TABLE operations may be executed concurrently with backup, it would be simpler to keep writing redo log, and not having backups fail, and not need any --lock-ddl-per-table option that makes backup interfere with the normal operation of the server. This would also remove the need to flush dirty pages from the buffer pool before committing the ALTER TABLE operation. On the other hand, when bulk loading data (before |
| Comments |
| Comment by Vladislav Vaintroub [ 2018-07-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
The backup does not have to fail, it still can succeed by re-copying the affected tablespace at the end of backup (this technique necessary on other reasons, e.g when recreating tables see | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-07-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
True, during backup, the MLOG_INDEX_LOAD record could be handled by copying the affected files (or pages) at the end of the backup. Theoretically, it should suffice to only copy the B-tree pages starting from the root page indicated by each MLOG_INDEX_LOAD record. While this extra copying is taking place, the log would still need to be copied. If the operation is a table rebuild (there is a MLOG_INDEX_LOAD record for the clustered index root page, that is, page number 3), then it is simplest to copy the entire file. When it comes to | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Thirunarayanan Balathandayuthapani [ 2018-07-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Patch looks good to me | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-07-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thank you for the review. I wrote a test case, which shows that the redo logging is not correct for ROW_FORMAT=COMPRESSED:
If the ALTER TABLE included ,FORCE (forcing a rebuild), then this may fail due to files being renamed, and not having If the ROW_FORMAT=COMPRESSED is not commented out, then the mariabackup --prepare would fail:
I think that we must also test a rebuild of tables that contain BLOBs (and using small innodb_log_file_size). But testing rebuild would be tricky before we have |