aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-11-03 21:20:27 +0100
committerGitHub <noreply@github.com>2021-11-03 21:20:27 +0100
commit1e7c796e66a692cd097b155bd0a60fedf20d554f (patch)
tree97b95ba684acdb9a2e4543c028f2a702e8a4e893
parentae14113969848239f8caebafd68df365c8b4d536 (diff)
parent14fcf1727759f8eaf88a805cbe2251fbe9920edb (diff)
Merge pull request #5475 from doronbehar/SQLiteWAL-vfs
libstore: Use unix-dotfile vfs if useSQLiteWAL is false
-rw-r--r--src/libstore/sqlite.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libstore/sqlite.cc b/src/libstore/sqlite.cc
index 447b4179b..1d6baf02d 100644
--- a/src/libstore/sqlite.cc
+++ b/src/libstore/sqlite.cc
@@ -1,4 +1,5 @@
#include "sqlite.hh"
+#include "globals.hh"
#include "util.hh"
#include <sqlite3.h>
@@ -27,8 +28,12 @@ namespace nix {
SQLite::SQLite(const Path & path, bool create)
{
+ // useSQLiteWAL also indicates what virtual file system we need. Using
+ // `unix-dotfile` is needed on NFS file systems and on Windows' Subsystem
+ // for Linux (WSL) where useSQLiteWAL should be false by default.
+ const char *vfs = settings.useSQLiteWAL ? 0 : "unix-dotfile";
if (sqlite3_open_v2(path.c_str(), &db,
- SQLITE_OPEN_READWRITE | (create ? SQLITE_OPEN_CREATE : 0), 0) != SQLITE_OK)
+ SQLITE_OPEN_READWRITE | (create ? SQLITE_OPEN_CREATE : 0), vfs) != SQLITE_OK)
throw Error("cannot open SQLite database '%s'", path);
if (sqlite3_busy_timeout(db, 60 * 60 * 1000) != SQLITE_OK)