mirror of
https://github.com/ciur/papermerge.git
synced 2026-04-25 03:55:58 +03:00
[GH-ISSUE #253] Switch SQLite to WAL mode #204
Labels
No labels
2.1
3.0
3.0.1
3.0.2
3.0.3
3.0.3
3.1
3.2
3.2
3.3
3.5
3.x
Fixed. Waiting for feedback.
Fixed. Waiting for feedback.
UX
Version 2.1 - alpha
XSS
announcement
beta
blocker
bug
cannot reproduce
confirmed
confirmed
critical
demo
dependencies
deployment
detchnical debt
discussion
docker
documentation
donations
duplicate
enhancement
feature request
frontend
fundraising
good first issue
good issue
help wanted
high
implemented
important
improvement
incomplete
invalid
investigation
kubernetes
low
low impact
medium
medium
medium impact
migration from 2.0
migration from 2.1
missing-language
missing-ocr-language
no-activity
note
ocr
outofscope
packaging
performance
popular request
pull-request
pypi
question
raspberry pi
roadmap
search
security
setup
status
task
technical debt
updates
user xp
version 1.4.0 - demo
will be implemented
will not be implemented
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/papermerge#204
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Mirodin on GitHub (Dec 12, 2020).
Original GitHub issue: https://github.com/ciur/papermerge/issues/253
Originally assigned to: @ciur on GitHub.
Is your feature request related to a problem? Please describe.
When I migrated my documents to Papermerge I stumbled upon a bottlenecks in SQLite when simultaneously adding documents and browsing the webinterface: a bunch of "database is locked" exceptions popped up in my logs. As I highly welcom SQLite as first class citizen I dug a little in the database settings and found that it was using the default rollback option, which causes a write operation to lock the database for any read operation whilst performing the write.
Describe the solution you'd like
I propose a switch to SQLite's Write-Ahead Logging as this allows simultaneus writes (i.e. worker indexing document) and reading (browsing the interface). I tried this here for my own system and just executing
PRAGMA journal_mode = wal;drastically increased performance of the webinterface and stopped "database is locked" errors from popping up in the log file. As this is not a breaking change, implementation would be quite easy.@ciur commented on GitHub (Dec 14, 2020):
@Mirodin, nice idea, thanks! I will definitely add that config!
@ciur commented on GitHub (Feb 22, 2021):
@Mirodin,
I tried to enable WAL mode with following code placed in papermerge.core.signals module:
Although code executes Ok, i still receive
django.db.utils.OperationalError: database is lockedwhen uploading two ore more file in same time (i.e. papermerge browse viewer -> upload -> select 2 or more files -> exception in logs).From Django documentation:
if you know a solution which works, I am happy to go ahead with it.
Related to WAL mode for SQLite I found this opened django ticket.