On 1 Feb 2016, at 9:23am, bm.email01 at gmail.com wrote:

> ---
> No, SQLite does not. On COMMIT it fsyncs the database file and unlinks the
> journal[1], but does not fsync the directory.
> ---
> 
> Since that can cause the last transaction to be lost, despite Sqlite 
> returning a 'Commit successful' code to the application, doesn't that mean 
> that Sqlite is _not_ truly 'Durable' (per ACID)?

1) The fault here is the file system not SQLite.  This one particular file 
system has this strange requirement that you fsync the directory.  SQLite is 
ACID.  It's the file system that messes it up.  SQLite cannot defend against 
untrustworthy middleware -- sooner or later a programmer has to trust their 
hardware is doing what it says it's doing.

2) Even if this were fixed, with an fsync of the directory included in the VFS, 
your storage system lies to the OS.  So you still wouldn't get ACID behaviour 
because your storage system isn't ACID.  SQLite cannot defend against 
untrustworthy storage -- sooner or later a programmer has to trust their 
hardware is doing what it says it's doing.

3) For both the above problems SQLite still neither loses data nor corrupts the 
database file.  If the program crashes the file is automatically closed.  When 
the SQLite API is used to reopen the file the unexpected close will be 
discovered and corrected for.

Simon.

Reply via email to