Question about WAL Checkpoint process
When SQLite start Checkpoint,is there a backup file create to avoid crash in between multi write into into main file?
for example if there need copy 1000 page into main file, what happy if app crashed at write 999 page?
If they are create backup file and rename it late for atomic, this will cause a lot IO for a huge database(for example 1TB database). Is this the case for SQLite?
I know there is batch-atomic-write to solve this problem, but that only work for F2FS.
The WAL file is the backup. When a page is successfully checkpointed the database is updated to reflect this. If page 1000 was not written successfully, clients continue to read it from the WAL file as if the checkpoint of that page never even started.
The checkpoint operation does not create a backup of the database, the pages being copied into the main file will not be marked as checkpointed in the WAL until after the copy is successful (here's your atomic commit). If the copy process breaks for any then the pages written are ignored (as they still show up as uncheckpointed in the WAL) and can be recovered from the WAL later