mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Merge pull request #5475 from doronbehar/SQLiteWAL-vfs
libstore: Use unix-dotfile vfs if useSQLiteWAL is false
This commit is contained in:
commit
1e7c796e66
1 changed files with 6 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
#include "sqlite.hh"
|
#include "sqlite.hh"
|
||||||
|
#include "globals.hh"
|
||||||
#include "util.hh"
|
#include "util.hh"
|
||||||
|
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
|
@ -27,8 +28,12 @@ namespace nix {
|
||||||
|
|
||||||
SQLite::SQLite(const Path & path, bool create)
|
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,
|
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);
|
throw Error("cannot open SQLite database '%s'", path);
|
||||||
|
|
||||||
if (sqlite3_busy_timeout(db, 60 * 60 * 1000) != SQLITE_OK)
|
if (sqlite3_busy_timeout(db, 60 * 60 * 1000) != SQLITE_OK)
|
||||||
|
|
Loading…
Reference in a new issue