Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Enable WAL for SQLite (#13897)
Browse files Browse the repository at this point in the history
Signed-off-by: Lorenzo Manacorda <lorenzo@mailbox.org>
  • Loading branch information
asymmetric authored Oct 25, 2022
1 parent 19c0e55 commit 8c94dd3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/13897.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enable Write-Ahead Logging for SQLite installs. Contributed by [asymmetric](https://github.com/asymmetric).
4 changes: 4 additions & 0 deletions synapse/storage/engines/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ def on_new_connection(self, db_conn: "LoggingDatabaseConnection") -> None:

db_conn.create_function("rank", 1, _rank)
db_conn.execute("PRAGMA foreign_keys = ON;")

# Enable WAL.
# see https://www.sqlite.org/wal.html
db_conn.execute("PRAGMA journal_mode = WAL;")
db_conn.commit()

def is_deadlock(self, error: Exception) -> bool:
Expand Down

0 comments on commit 8c94dd3

Please sign in to comment.