Durability & fsync
- After each WAL segment is written, an
fsyncis performed on the currently open WAL file to ensure durability. - An
fsyncis triggered when a WAL segment is completed and the*.partialfile is renamed to its final form. - An
fsyncis triggered when a keepalive message is received from the server with thereply_requestedoption set. - Additionally,
fsyncis called whenever an error occurs during the receive-copy loop.