Hacker News new | ask | show | jobs
by magicalhippo 2075 days ago
Ah of course, how silly of me to forget about the log. Thank you, that makes perfect sense.
1 comments

It's more complex than the above. The key constraint is actually that the transaction is not allowed to return as committed until the WAL is stable on disk. Whether the writes it did to various pages are allowed before that point or held until after is an implementation choice, and different databases make different choices. It gets complex fast, but the short summary is that the recovery protocols understand how to reconstruct the state after the fact, redo what needs to be redone, and undo what needs to be undone.