Re: [sqlite] Suggestion for PRAGMA SYNCHRONOUS=0 documentation

2017-07-14 Thread Clemens Ladisch
Rowan Worth wrote:
> I do think it's worth a mention in the PRAGMA SYNCHRONOUS=0 documentation
> that sqlite3_close() doesn't propagate I/O errors so you might never hear
> about write failures in this mode.

When writing asynchronously, errors can be detected _after_ the close, so
this is not even a problem with sqlite3_close() itself.


Regards,
Clemens
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Suggestion for PRAGMA SYNCHRONOUS=0 documentation

2017-07-14 Thread Rowan Worth
Hi guys,

Ran into an interesting case today where one of our programs was writing an
sqlite DB to a network file system. Just as it was finishing up there was a
brief connectivity issue, and sqlite's call to close() ran into an EIO
error.

Sqlite3_close() doesn't return an error in this case so it wasn't
immediately obvious that anything had gone wrong - the program claimed to
finish successfully but the result was a corrupt DB. Later we found
sqlite's warning in a log file explaining what happened.

Personally I think it would be courteous for sqlite3_close() to return
SQLITE_IOERR in this case, but I acknowledge that any sane/honest VFS layer
would have reported any error at the last sync() call.


... so the final arc of the story, as you may have guessed from the subject
line, is that this program uses PRAGMA SYNCHRONOUS=0 for performance
reasons and therefore there is no sync() call.


If you think everything through carefully there's no real surprises here,
and I don't really have an issue with sqlite's behaviour. But I do think
it's worth a mention in the PRAGMA SYNCHRONOUS=0 documentation that
sqlite3_close() doesn't propagate I/O errors so you might never hear about
write failures in this mode.


And yes I appreciate that writing to a network file system without sync()
is about as unsupported as possible :)

Cheers,
-Rowan
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users