Effect WAL Crash Recovery
A write-ahead log so a crash mid-write can always be finished or discarded. Applying updates straight to pages leaves a crash with some pages new and some old and no way to tell which; the WAL rule appends the change and fsyncs it before touching pages, so recovery redoes committed transactions and ignores uncommitted ones. Without checkpoints recovery would replay all of history and the log would grow forever; a checkpoint flushes a durable page image and records that everything up to LSN N is safe, so recovery only replays the suffix. The demo survives a crash for committed writes, discards an uncommitted one, and bounds replay to the post-checkpoint tail. Pinned to effect 4.0.0-beta.98.
npx shadcn@latest add https://ui.aryank.space/r/effect-wal-crash-recovery.jsonInstalls from ui.aryank.space. To add it by hand, copy the files in Files below, or register the @compronents namespace via the docs.
The change was logged and fsynced before the pages were touched, and the transaction committed. A crash wipes the volatile pages, but recovery redoes the committed write from the log.