On 25 Dec 2014, at 12:32pm, Rick Kelly <rpke...@gci.net> wrote:

> If a request encounters %SQLITE_BUSY or %SQLITE_LOCKED, I'm retrying up to 5
> times with a 100ms sleep in between.
> 
> Will this approach minimize %SQLITE_BUSY and %SQLITE_LOCKED situations and
> provide decent concurrency and long term stability? 

Do not do the retrying inside your own code.  Instead set a busy_timeout and 
let SQLite handle all retrying itself:

<https://www.sqlite.org/c3ref/busy_timeout.html>
<https://www.sqlite.org/pragma.html#pragma_busy_timeout>

SQlite will then take care of all the retrying for you.  A timeout of a minute 
or two might seem strange, but if you think about what you'd want to happen if 
the database is busy it starts to make sense.

If SQLite is still reporting SQLITE_BUSY or SQLITE_LOCKED after this you can 
treat it as an unrecoverable error indicating hardware or network problems.

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

Reply via email to