aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-06-29 15:42:53 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-06-29 15:42:53 +0100
commitc6c53071887820bb7f96162658c884a5cb947a9b (patch)
tree6ae73185225f077829d1c65ba46a8295ac9df357 /src
parent393856a7b62ebd8da5edf34f83fb3e55db6083b9 (diff)
downloadrspamd-c6c53071887820bb7f96162658c884a5cb947a9b.tar.gz
rspamd-c6c53071887820bb7f96162658c884a5cb947a9b.zip
Use WAL for fuzzy storage as well.
Diffstat (limited to 'src')
-rw-r--r--src/libserver/fuzzy_backend.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libserver/fuzzy_backend.c b/src/libserver/fuzzy_backend.c
index c59fa6133..0cf2f8cfa 100644
--- a/src/libserver/fuzzy_backend.c
+++ b/src/libserver/fuzzy_backend.c
@@ -377,6 +377,8 @@ rspamd_fuzzy_backend_open_db (const gchar *path, GError **err)
{
struct rspamd_fuzzy_backend *bk;
sqlite3 *sqlite;
+ static const char sqlite_wal[] = "PRAGMA journal_mode=WAL;",
+ fallback_journal[] = "PRAGMA journal_mode=OFF;";
int rc;
if ((rc = sqlite3_open_v2 (path, &sqlite,
@@ -402,6 +404,11 @@ rspamd_fuzzy_backend_open_db (const gchar *path, GError **err)
prepared_stmts[RSPAMD_FUZZY_BACKEND_COUNT].stmt, 0);
}
+ if (sqlite3_exec (sqlite, sqlite_wal, NULL, NULL, NULL) != SQLITE_OK) {
+ msg_warn ("WAL mode is not supported, locking issues might occur");
+ sqlite3_exec (sqlite, fallback_journal, NULL, NULL, NULL);
+ }
+
rspamd_fuzzy_backend_run_simple (RSPAMD_FUZZY_BACKEND_TRANSACTION_START,
bk, NULL);