diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-09-10 11:15:05 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-09-10 11:15:05 +0100 |
commit | 316fe3e293a4737f0124c34f35cbbc55e97d0455 (patch) | |
tree | 92b3d55a71d4277f605ca64f9bfffcd1572d8273 /src/libutil/sqlite_utils.c | |
parent | 38a6ceb5fff743c2233b79920ee2d1ff7a6a0cdc (diff) | |
download | rspamd-316fe3e293a4737f0124c34f35cbbc55e97d0455.tar.gz rspamd-316fe3e293a4737f0124c34f35cbbc55e97d0455.zip |
Relax synchronization mode in sqlite3.
Diffstat (limited to 'src/libutil/sqlite_utils.c')
-rw-r--r-- | src/libutil/sqlite_utils.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libutil/sqlite_utils.c b/src/libutil/sqlite_utils.c index 18e3710ba..7e12a2782 100644 --- a/src/libutil/sqlite_utils.c +++ b/src/libutil/sqlite_utils.c @@ -248,7 +248,8 @@ rspamd_sqlite3_open_or_create (rspamd_mempool_t *pool, const gchar *path, const gint rc, flags, lock_fd; gchar lock_path[PATH_MAX], dbdir[PATH_MAX], *pdir; static const char sqlite_wal[] = "PRAGMA journal_mode=\"wal\";", - exclusive_lock_sql[] = "PRAGMA locking_mode=\"exclusive\";"; + exclusive_lock_sql[] = "PRAGMA locking_mode=\"exclusive\";", + fsync_sql[] = "PRAGMA database.synchronous=1;"; gboolean create = FALSE, has_lock = FALSE; flags = SQLITE_OPEN_READWRITE; @@ -371,6 +372,11 @@ rspamd_sqlite3_open_or_create (rspamd_mempool_t *pool, const gchar *path, const sqlite3_errmsg (sqlite)); } + if (sqlite3_exec (sqlite, fsync_sql, NULL, NULL, NULL) != SQLITE_OK) { + msg_warn_pool ("cannot set database.synchronous: %s", + sqlite3_errmsg (sqlite)); + } + if (has_lock) { msg_debug_pool ("removing lock from %s", lock_path); rspamd_file_unlock (lock_fd, FALSE); |