Pārlūkot izejas kodu

Relax synchronization mode in sqlite3.

tags/1.0.0
Vsevolod Stakhov pirms 8 gadiem
vecāks
revīzija
316fe3e293
1 mainītis faili ar 7 papildinājumiem un 1 dzēšanām
  1. 7
    1
      src/libutil/sqlite_utils.c

+ 7
- 1
src/libutil/sqlite_utils.c Parādīt failu

@@ -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);

Notiek ielāde…
Atcelt
Saglabāt