WAL Checkpoint Blocking Behavior

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

WAL Checkpoint Blocking Behavior

Matt Fichman
Hi all,

I'm trying to use SQLite in an asynchronous application that requires
low/predictable latency access to the database. To achieve this is, I plan
to disable WAL autocheckpoints and manually run permissive WAL checkpoints
on a second thread (as hinted at by the docs).

If I do this, can a WAL checkpoint on the checkpoint thread still block or
significantly delay queries/updates from the main thread?

Thanks!
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: WAL Checkpoint Blocking Behavior

Clemens Ladisch
Matt Fichman wrote:
> I plan to disable WAL autocheckpoints and manually run permissive WAL
> checkpoints on a second thread (as hinted at by the docs).
>
> If I do this, can a WAL checkpoint on the checkpoint thread still block or
> significantly delay queries/updates from the main thread?

The documentation says <http://www.sqlite.org/c3ref/wal_checkpoint_v2.html>:
| Checkpoint as many frames as possible without waiting for any database
| readers or writers to finish, then sync the database file if all frames
| in the log were checkpointed.  [...] passive mode might leave the
| checkpoint unfinished if there are concurrent readers or writers.

A passive checkpoint does not interfere with any other connection that
is currently reading or writing. But if the checkpoint gets the databse
lock first, the other connection must wait.


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users