Master the fundamental concepts of storage fundamentals through this focused micro-challenge.
A database page write is not durable until bytes reach non-volatile media. fsync on a file descriptor blocks until prior writes for that file are stored. Crash-safe protocols write the log first, sync it, then write data pages so recovery can replay incomplete updates.
Append WAL record, fsync WAL, modify data page, optionally fsync data. On crash after WAL sync, recovery reapplies committed work.
cLoading…
fdatasync skips inode metadata when safeKeep the relevant documentation open while you implement. When your output disagrees with the reference, trace one failing case by hand before changing random lines.
You will simulate ordered writes and show which steps survive a crash at each point. This exercise asks you to implement the WAL-first sync protocol in the starter simulation.
Write a C program that simulates crash-safe write ordering for a simple database update.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github