On 2015-03-25 03:47 PM, Rob van der Stel wrote: > One open issue for me remains however. Can I assume that the FlushFileBuffers > API that SQLite uses still causes cache to be written to disk even though the > 'automatic write-cache flushing' of Windows is turned off ?
Depends what you mean: - YES you may assume that SQLite when set to the appropriate sync mode and using the standard VFS will call flushfilebuffers on WIndows (or fsync() elsewhere) as described in the documentation - YES you may assume calling FlushFileBuffers actually flushes the buffers - NO you may not assume that the buffers are indeed finished committing data to disk surface/NAND once the Flushfilebuffers method returns (This depends on system settings). Also, Ketil's advice on making SQLite's page size coincide with your RAIDed block sizes is a good optimization in both speed and security*, and at the risk of sounding repetitive, consider WAL mode if file growth is not a big problem and you have proportionally many data writes (in relation to reads). WAL mode is much more secure* to boot (with proper sync settings). * - In both cases "secure" doesn't imply some special security additions, but rather simply the fact that less calls to fsync()/FlushFileBuffers and less pages/blocks needing flushing per disk transaction have less probability of failing. One could argue that the logic processing of the WAL is also more secure, but that's a different discussion. Good luck! Ryan