Loading the code workspace…
Write a C program that simulates crash-safe write ordering for a simple database update.
Requirements:
This write-then-fsync ordering rule is exactly what PostgreSQL got catastrophically wrong in the 2018 'fsyncgate' bug, where the kernel silently discarded write errors on retry and Postgres recovery replayed corrupted data as if it were valid. Group commit, the optimization Strategy C hints at, is how PostgreSQL and MySQL batch dozens of transactions into a single fsync to keep durability affordable.