diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-05 18:58:13 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-05 18:58:13 +0100 |
commit | 763ab77075df986497e7b6937d33d5f487ba7fc6 (patch) | |
tree | c00911e4f77c7910e0e7f36432c5c97fabb35dc9 /src/libutil/sqlite_utils.c | |
parent | 18a45837c555962fc16e21da6755707e48518893 (diff) | |
download | rspamd-763ab77075df986497e7b6937d33d5f487ba7fc6.tar.gz rspamd-763ab77075df986497e7b6937d33d5f487ba7fc6.zip |
Enable mmap in sqlite3.
Diffstat (limited to 'src/libutil/sqlite_utils.c')
-rw-r--r-- | src/libutil/sqlite_utils.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libutil/sqlite_utils.c b/src/libutil/sqlite_utils.c index d677a0dc2..980d07abc 100644 --- a/src/libutil/sqlite_utils.c +++ b/src/libutil/sqlite_utils.c @@ -250,7 +250,8 @@ rspamd_sqlite3_open_or_create (rspamd_mempool_t *pool, const gchar *path, const static const char sqlite_wal[] = "PRAGMA journal_mode=\"wal\";", exclusive_lock_sql[] = "PRAGMA locking_mode=\"exclusive\";", fsync_sql[] = "PRAGMA synchronous=1;", - foreign_keys[] = "PRAGMA foreign_keys=\"ON\";"; + foreign_keys[] = "PRAGMA foreign_keys=\"ON\";", + enable_mmap[] = "PRAGMA mmap_size=268435456;"; gboolean create = FALSE, has_lock = FALSE; flags = SQLITE_OPEN_READWRITE; @@ -384,6 +385,13 @@ rspamd_sqlite3_open_or_create (rspamd_mempool_t *pool, const gchar *path, const sqlite3_errmsg (sqlite)); } + if (sizeof (gpointer) >= 8 && + (rc = sqlite3_exec (sqlite, enable_mmap, NULL, NULL, NULL)) != + SQLITE_OK) { + msg_warn_pool ("cannot enable mmap: %s", + sqlite3_errmsg (sqlite)); + } + if (has_lock) { msg_debug_pool ("removing lock from %s", lock_path); rspamd_file_unlock (lock_fd, FALSE); |