On a typical COW filesystem, is the database WAL redundant (in theory)?
-
21-02-2021 - |
Pergunta
EDIT: I was incorrectly assuming that all COW filesystems have a WAL. IT seems that BTRFS doesn't, so this question essentially applies only to ZFS.
Typical COW filesystems, like ZFS, have their own form of WAL (ZIL, in the case of ZFS).
On a non-COW filesystem, the DB WAL makes sense for both performance (because it's sequential) and integrity reasons (because of the lack of write integrity guarantees); on a COW filesystem, those roles are fulfilled by the FS (WAL).
Because of this, doesn't storing DB data on a COW filesystem make the DB WAL redundant?
Solução
No, because the WAL is also used for restoring from backups -- for example, in case of user error. In combination with a prior full backup, it allows restoring to any point in time -- presumably prior to when the user did something bad.
Outras dicas
Also no because a transaction may require changing hundreds of different locations in a file, and copy-on-write does nothing to make that faster. But write-ahead logging allows all the changes to be written in a minimal number on IOs, and applied to the data files later. The later writes are asynchronous, and benefit from write coalescing, so a file location modified by many transactions may be written to only once.