Write-Ahead Logging and Durability Order

Protect database changes by flushing enough log before a data page or a successful commit can be considered durable.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Explain a change before persisting changed bytes
  2. Acknowledging commit requires a recovery contract

Explain a change before persisting changed bytes

When a transaction updates a page in memory, the engine can append a record describing enough of that update for recovery. If that dirty page can reach durable storage before commit, the relevant log must already be durable before the page write. Otherwise recovery can encounter changed bytes without evidence needed to interpret or undo them. This is the write-ahead rule at the data boundary.

Acknowledging commit requires a recovery contract

In a typical no-force design, commit can make the transaction’s log and decision durable without flushing all its data pages immediately. Recovery can replay missing changes. Group commit may share a flush across several transactions while each acknowledgment still waits for its required log position. Log sequence numbers state that dependency precisely. Redo and undo explain consequences of the actual pages found after a crash.[1][2]

References

  1. C. Mohan et al., ARIES: A Transaction Recovery Method ↩
  2. CMU 15-445/645, Introduction to Database Systems: Lectures ↩