I've created an application that makes use of SQLite3. Occasionally,
multiple instances of that application run at the same time and need
to write to the database simultaneously. When I decided to use SQLite
I was under the impression that the support for multiple writers doing
massive parallel writes in SQLite is weak but I was assuming this is a
performance issue only. However, it turned out that this is a functional
limitation. Even with only two writers INSERTs fail in a nonpredictable
manner. I played with the busy handler and opened a ticket [1] but in
the end I can only choose between deadlock and failure. There is a
workaround for the latter encapsulating every SQL execution with a retry
when the failure was SQL_BUSY and that's exactly what I did [2].

I cannot believe it is normal behavior of a database application running
on a multitasking operating system to assume there will only be one
writer and otherwise let the application fail or do retries by itself.

What are you guys doing to prevent such conditions? I mean, if someone
uses SQLite for a very simple web application that application must
either only read the database. Or otherwise the users have to pray no
two of them ever click the submit button at the same time.

[1] http://www.sqlite.org/cvstrac/tktview?tn=1159
[2] http://cvs.openpkg.org/chngview?cn=22124

--
[EMAIL PROTECTED], Cable & Wireless

Reply via email to