From f09d896f8ec223041511698c602366fd00e4f7ba Mon Sep 17 00:00:00 2001 From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Tue, 14 Apr 2026 16:22:45 -0700 Subject: [PATCH] Clarify isolation_level intent and cache_size unit --- src/paperless/settings/custom.py | 5 ++++- src/paperless/tests/settings/test_custom_parsers.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/paperless/settings/custom.py b/src/paperless/settings/custom.py index 274dbbc05..9e9468e21 100644 --- a/src/paperless/settings/custom.py +++ b/src/paperless/settings/custom.py @@ -235,7 +235,7 @@ def parse_db_settings(data_dir: Path) -> dict[str, dict[str, Any]]: "PRAGMA temp_store=MEMORY;" "PRAGMA mmap_size=134217728;" "PRAGMA journal_size_limit=67108864;" - "PRAGMA cache_size=-8000" + "PRAGMA cache_size=-8000" # negative = KiB; -8000 ≈ 8 MB ), # IMMEDIATE acquires the write lock at BEGIN, ensuring # busy_timeout is respected from the start of the transaction. @@ -285,6 +285,9 @@ def parse_db_settings(data_dir: Path) -> dict[str, dict[str, Any]]: "key": os.getenv("PAPERLESS_DBSSLKEY"), }, # READ COMMITTED eliminates gap locking and reduces deadlocks. + # Django also defaults to "read committed" for MySQL/MariaDB, but + # we set it explicitly so the intent is clear and survives any + # future changes to Django's default. # Requires binlog_format=ROW if binary logging is enabled. "isolation_level": "read committed", } diff --git a/src/paperless/tests/settings/test_custom_parsers.py b/src/paperless/tests/settings/test_custom_parsers.py index cf0321e80..0443c5e99 100644 --- a/src/paperless/tests/settings/test_custom_parsers.py +++ b/src/paperless/tests/settings/test_custom_parsers.py @@ -354,7 +354,7 @@ class TestParseDbSettings: }, }, }, - id="sqlite-init-command-override", + id="sqlite-options-override", ), pytest.param( {