You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a specialized pool for SQLite that has a reader / writer split #459
In our experience at chatmail/core#2089 opening reader connections with read only mode while writer connections are open with read-write mode caused some tests to break. Didn't look further, but probably it's better to open all connections with the same settings and limit reader connections with query_only PRAGMA.
Any update on this? I'm experiencing intermittent database is locked errors similar to this that render my IOT application unresponsive until reboot. Obviously I can't go to production with this issue so I'm wondering whether to build my own locking mechanism or hold off for a sqlx solution.
@D1plo1d For an IOT application, you should be fine doing exactly as that blog article. Either don't use the pool and put a Mutex around a single SqliteConnection or use a max_connections of 1 with the pool. This reduces some throughput but will prevent all potential locking issues.
Thank, I'll give that a shot. max_connections is an easy enough change for me. I'm guessing that is effectively turning the pool into a mutex around one Sqlite connection?
Activity
Cocalus commentedon Jun 28, 2020
I suspect you know this, but just as a reminder
This only avoids busy locks when the database is using the wal journal. While very often the best mode, it's not the default because it does have some limits.
https://sqlite.org/wal.html
In the SqlitePool documentation I would suggest adding a link to the wal docs so the user is reminded that they probably want a wal journal.
Also you probably should use
SQLITE_OPEN_READONLY
With the read connections, to catch client misuse of the read connections.
link2xt commentedon Apr 1, 2021
In our experience at chatmail/core#2089 opening reader connections with read only mode while writer connections are open with read-write mode caused some tests to break. Didn't look further, but probably it's better to open all connections with the same settings and limit reader connections with
query_onlyPRAGMA.D1plo1d commentedon Apr 27, 2021
Any update on this? I'm experiencing intermittent
database is lockederrors similar to this that render my IOT application unresponsive until reboot. Obviously I can't go to production with this issue so I'm wondering whether to build my own locking mechanism or hold off for a sqlx solution.mehcode commentedon Apr 27, 2021
@D1plo1d For an IOT application, you should be fine doing exactly as that blog article. Either don't use the pool and put a
Mutexaround a singleSqliteConnectionor use amax_connectionsof 1 with the pool. This reduces some throughput but will prevent all potential locking issues.D1plo1d commentedon Apr 27, 2021
Thank, I'll give that a shot.
max_connectionsis an easy enough change for me. I'm guessing that is effectively turning the pool into a mutex around one Sqlite connection?aalowlevel commentedon Nov 20, 2023
Any news?