
On 25/03/2017 20:01, Lee Clagett via Boost wrote:
At this point I'm sure Niall will tell me that writing <512 bytes to the beginning of the file is also not an atomic operation. Which is exactly what SQLite documentation assumes. The power-loss recovery algorithm gets tougher with this assumption.
That is a really fascinating topic I could write a really long email about, but one I won't bore the list with. See http://stackoverflow.com/a/35258623/805579. In short, if O_DIRECT is off, assume no atomicity at all, if O_DIRECT is on, probably infinity on all very recent POSIX systems, Windows varies between 64 bytes and 4096 bytes depending on DMA. This refers *purely* to *user observed effects*, and has no relation to what order stuff actually hits physical storage. Note that even if a device claims 512 byte blocks, no SSD actually implements that in flash and you are reliant on the SSD doing a reliable RCU under sudden power loss. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/