3 ms·
> the war stories that PostgreSQL developers could tell about disk syncing. The man page for glibc open(2) used to say, "Most Linux filesystems don't actually
by cratermoon 3y ago
> the war stories that PostgreSQL developers could tell about disk syncing.
The man page for glibc open(2) used to say, "Most Linux filesystems don't actually implement the POSIX O_SYNC semantics, which require all metadata updates of a write to be on disk on returning to userspace", but now it notes that "before Linux 2.6.33" it wasn't implemented correctly
I remember a rather eye-opening discussion on either the postgresql-hackers or lkml about the semantics of O_SYNC not actually being synchronous. In addition to the implementation details, which depended on the version of the kernel and the underlying filesystem type, it was also noted that underlying disk hardware also had caches which did not necessarily behave synchronously.
Some places I can find that cover these details include
https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg272253.html https://www.mail-archive.com/linux-kernel@vger.kernel.org/ms...
http://milek.blogspot.com/2010/12/linux-osync-and-write-barriers.html http://milek.blogspot.com/2010/12/linux-osync-and-write-barr...
https://lwn.net/Articles/352229/ https://lwn.net/Articles/352229/
- sroussey 3y agoRAID cards back in the day, and some enterprise SSDs today either had batteries or capacitors in order to finish the write, even if the power turned off. They tell the OS that the write has synced even when it has not as it has confidence that it will.