2 ms·
> Are sector writes atomic? And if so, for what size sectors? As a PostgreSQL hacker I have the same question, and I know the MySQL people do too, and I wrote
by macdice 6y ago
> Are sector writes atomic? And if so, for what size sectors?
As a PostgreSQL hacker I have the same question, and I know the MySQL people do too, and I wrote some more specific questions and backgound, over here: https://wiki.postgresql.org/wiki/FreeBSD/AtomicIO https://wiki.postgresql.org/wiki/FreeBSD/AtomicIO
- octoberfranklin 6y agoI think the answer to both questions is "sometimes", and most kernels go out of their way to avoid ever answering this question. They just don't want responsibility for it.
- imhoguy 6y agoBecause kernel devs are not able to answer that. It is beyond kernel control as SSDs are backed by nested operating systems under the hood with own bugs and non-determinism.
- octoberfranklin 6y agoTo be fair, the solution here would be for the kernel devs to ask the "SCSI council" (or whoever picks the ATA opcodes these days) and the NVMe sig to create a mechanism by which the device can communicate its durability guarantees, if any. If they decline to create one then the kernel devs can just declare one (even if nobody implements it). Failure to implement the API is, of course, equivalent to reporting "no guarantee" for all queries. Then they could at least say "we're doing everything we can; next time you buy a storage device look for feature X".
- twhitmore 6y agoBut to be honest, persistence & durability of data are the primary goal of a Storage API. I don't agree these factors should be hidden, unless the API guarantees every single operation is atomic & durable. Full details as to atomicity & durability need be available to callers (not just SQLite, but any application that wants to provide a reliable datastore) so that they can write information durably including across coordinated multi-file data structures.