On 15 Oct 2012, at 3:28am, Larry Knibb <larry.kn...@gmail.com> wrote:

> Recently, I've started
> seeing these errors related to some of the INSERT calls:
> 
> DatabaseError: database disk image is malformed
> StorageError: database disk image is malformed
> 
> Given the scenario (and being familiar with
> http://www.sqlite.org/whentouse.html), I suspect this almost certainly
> an issue caused by concurrent writes to the database, but I'd like
> some advice before move to MySQL or similar.
> 
> Would using TRANSACTIONs on the INSERTs prevent this issue? If
> necessary, by combining this with a delay-retry mechanism in the
> client code.

No.  Specifying an INSERT without a transaction just makes SQL wrap it in a 
transaction of its own.  I don't think that will improve anything.  What you 
can do is introduce your own timeout and see if this changes anything, just as 
something to try.

<http://www.sqlite.org/c3ref/busy_timeout.html>

> Any other tips or tricks to shore-up the robustness, or should I just
> limber up my throwing arm and call for the towel?

Are you connecting across a network ?  Even if it's just one server and a 
network-mounted disk.  Generally, network file systems do not implement locking 
properly and this can present problems.

Are you using any PRAGMAs ?  I'm not recommending them -- in fact lack of 
PRAGMAs is probably the least likely to generate errors -- but it's important 
for that kind of problem.  If you're using any, try it without.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to