Crash Recovery and Write-Ahead Logging
Durability is achieved by writing the intention to a log before touching the data pages. After a crash the system replays committed work and undoes the rest, which is how a commit can be trusted the moment it returns.
Ce que l'enfant saura faire ensuite
- Order the log write, the commit record and the page write, and say why
- Walk through redo and undo for a log that ends mid-transaction
- Explain what a checkpoint saves during recovery
1 · Lis
Durability is achieved by writing the intention to a log before a changed data page is written to disk. The order is strict: the log record first, then the page write, and the commit record only after every change of the transaction sits safely in the log. A commit can be trusted the moment it returns, because everything promised is already in the log.
Picture a log with two transactions: one finished with a commit record, one cut off mid stream with none. Recovery replays the committed work step by step until the pages match what was promised, which is called redo. The unfinished work gets rolled back and its partial changes removed, which is called undo. When recovery ends, every committed transaction is present and no unfinished one left a trace.
The log goes first because pages can be lost in a crash while the log survives on safe storage. If the intention is in the log, the work can be rebuilt. If it is not in the log, the work never happened, and nothing is owed to anyone.
Replaying a huge log takes time, so the system takes checkpoints. At a checkpoint it writes all pending changes into the data pages and notes the spot in the log. Recovery then starts from the last checkpoint instead of from the beginning, replaying only what came after.
Write the log before the pages, redo the committed, undo the rest, and checkpoint so recovery starts late.
The rewritten reading was written for this dataset.
2 · Regarde
En anglaisSans écran
Où se situe ce sujet
8 questions attendent derrière cette leçon, chacune avec sa réponse expliquée. Chaque réponse nourrit le ciel : les étoiles s'allument à mesure qu'elles sont apprises, et pâlissent quand vient le moment de revenir.
Commence ce sujet