[MDEV-20677] Renaming files may not be filesystem-crash-safe Created: 2019-09-26 Updated: 2021-06-30 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table, Storage Engine - InnoDB |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Michael Widenius |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | recovery | ||
| Issue Links: |
|
||||||||
| Description |
|
However, the file-renaming operations might not be carried out in a fashion that guarantees crash-safety in a case that involves file system recovery. To be safe, we should probably do fsync() of the file and the directory containing it, followed by the rename(), and finally an fsync() of the file and of its containing directory. This should be done both inside storage engines and in code that deals with .frm files and the like. |
| Comments |
| Comment by Sergei Golubchik [ 2019-09-30 ] |
|
these four fsyncs is what PostgreSQL does: https://linuxplumbersconf.org/event/4/contributions/492/attachments/344/573/errors.pdf#page=4 and they claim that even if not all fsyncs are always necessary, every single one of them is needed on at least some filesystems |
| Comment by Michael Widenius [ 2020-06-07 ] |
I would however argue that some of the above sync are not necessary for MariaDB during rename as:
Some things to think about:
Some other observations:
However as Atomic DDL has to be delayed to 10.6, this is a 10.6 issue not a 10.5 issue |