]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Fallback to no journal if WAL is not available.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 20 Jun 2015 21:56:59 +0000 (22:56 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 20 Jun 2015 21:56:59 +0000 (22:56 +0100)
src/libstat/backends/sqlite3_backend.c

index d784cea2039e1ca5165322331a3a88cd0f449edb..c85d774d8d8c13b94e4112ae2b42fc5363f4692b 100644 (file)
@@ -288,7 +288,8 @@ rspamd_sqlite3_opendb (const gchar *path, const ucl_object_t *opts,
        struct rspamd_stat_sqlite3_db *bk;
        sqlite3 *sqlite;
        gint rc, flags;
-       static const char sqlite_wal[] = "PRAGMA journal_mode=WAL;";
+       static const char sqlite_wal[] = "PRAGMA journal_mode=WAL;",
+                       fallback_journal[] = "PRAGMA journal_mode=OFF;";
 
        flags = SQLITE_OPEN_READWRITE;
 
@@ -318,6 +319,7 @@ rspamd_sqlite3_opendb (const gchar *path, const ucl_object_t *opts,
 
        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);
        }
 
        bk = g_slice_alloc0 (sizeof (*bk));