@@ -63,7 +63,7 @@ struct AttrDb
6363
6464 SymbolTable & symbols;
6565
66- AttrDb (const StoreDirConfig & cfg, const Hash & fingerprint, SymbolTable & symbols)
66+ AttrDb (bool useSQLiteWAL, const StoreDirConfig & cfg, const Hash & fingerprint, SymbolTable & symbols)
6767 : cfg(cfg)
6868 , _state(std::make_unique<Sync<State>>())
6969 , symbols(symbols)
@@ -75,7 +75,7 @@ struct AttrDb
7575
7676 auto dbPath = cacheDir / (fingerprint.to_string (HashFormat::Base16, false ) + " .sqlite" );
7777
78- state->db = SQLite (dbPath);
78+ state->db = SQLite (dbPath, {. useWAL = useSQLiteWAL} );
7979 state->db .isCache ();
8080 state->db .exec (schema);
8181
@@ -287,10 +287,11 @@ struct AttrDb
287287 }
288288};
289289
290- static std::shared_ptr<AttrDb> makeAttrDb (const StoreDirConfig & cfg, const Hash & fingerprint, SymbolTable & symbols)
290+ static std::shared_ptr<AttrDb>
291+ makeAttrDb (bool useSQLiteWAL, const StoreDirConfig & cfg, const Hash & fingerprint, SymbolTable & symbols)
291292{
292293 try {
293- return std::make_shared<AttrDb>(cfg, fingerprint, symbols);
294+ return std::make_shared<AttrDb>(useSQLiteWAL, cfg, fingerprint, symbols);
294295 } catch (SQLiteError &) {
295296 ignoreExceptionExceptInterrupt ();
296297 return nullptr ;
@@ -299,7 +300,8 @@ static std::shared_ptr<AttrDb> makeAttrDb(const StoreDirConfig & cfg, const Hash
299300
300301EvalCache::EvalCache (
301302 std::optional<std::reference_wrapper<const Hash>> useCache, EvalState & state, RootLoader rootLoader)
302- : db(useCache ? makeAttrDb(*state.store, *useCache, state.symbols) : nullptr)
303+ : db(useCache ? makeAttrDb(state.store->config.settings.useSQLiteWAL, *state.store, *useCache, state.symbols)
304+ : nullptr)
303305 , state(state)
304306 , rootLoader(rootLoader)
305307{
@@ -707,7 +709,7 @@ StorePath AttrCursor::forceDerivation()
707709 auto aDrvPath = getAttr (root->state .s .drvPath );
708710 auto drvPath = root->state .store ->parseStorePath (aDrvPath->getString ());
709711 drvPath.requireDerivation ();
710- if (!root->state .store ->isValidPath (drvPath) && !settings.readOnlyMode ) {
712+ if (!root->state .store ->isValidPath (drvPath) && !root-> state . store -> config . settings .readOnlyMode ) {
711713 /* The eval cache contains 'drvPath', but the actual path has
712714 been garbage-collected. So force it to be regenerated. */
713715 aDrvPath->forceValue ();
0 commit comments