[MDEV-23842] Atomic RENAME TABLE Created: 2020-09-29 Updated: 2022-11-01 Resolved: 2021-05-20 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Create Table |
| Fix Version/s: | 10.6.1 |
| Type: | Task | Priority: | Critical |
| Reporter: | Michael Widenius | Assignee: | Michael Widenius |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
Atomic rename table The purpose of this task is to ensure that RENAME TABLE is atomic. This task also includes atomic RENAME VIEW. How rename works in 10.5:
Notes
Special cases to consider:
The code also needs to take care of that a rename can fail in the engine for various reasons
How atomic rename should work: Normal operation
Recovery of active atomic rename entry In following code, all temporary tables can be ignored as these has
New handler calls needed
|
| Comments |
| Comment by Marko Mäkelä [ 2020-09-29 ] | ||||||||||||||||||||||
|
For the record, | ||||||||||||||||||||||
| Comment by Eugene Kosov (Inactive) [ 2020-11-12 ] | ||||||||||||||||||||||
|
In atomic.rename_table InnoDB redo log fails on renaming t5 -> t1. t1 already exists. On a previous run the following renames have happened: t1 -> t5 and t2 -> t1. But that t5 -> t1 probably comes from here (this is a previous daemon run before the crashed run):
So, recovery from a binlog renames InnoDB data files too! And it writes a redo log for such renamings. Should that code rename InnoDB files at all and generate a redo log? | ||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-11-13 ] | ||||||||||||||||||||||
|
According to my analysis, the InnoDB recovery of RENAME may fail if multiple tables were renamed since the latest log checkpoint, such that the same names are being reused. We will fix that in | ||||||||||||||||||||||
| Comment by Aleksey Midenkov [ 2021-02-07 ] | ||||||||||||||||||||||
|
next_entry, execute_entry_pos are redundant (they are stored inside list, execute_entry):
ddl_log_write_execute_entry_internal() is not used as well. |