1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 12:06:01 +01:00

Use WAL mode for SQLite cache databases

With "truncate" mode, if we try to write to the database while another
process has an active write transaction, we'll block until the other
transaction finishes. This is a problem for the evaluation cache in
particular, since it uses long-running transactions.

WAL mode does not have this issue: it just returns "busy" right away,
so Nix will print

  error (ignored): SQLite database '/home/eelco/.cache/nix/eval-cache-v5/...' is busy

and stop trying to write to the evaluation cache. (This was the
intended/original behaviour, see AttrDb::doSQLite().)
This commit is contained in:
Eelco Dolstra 2025-07-15 18:21:29 +02:00
parent bb600e1048
commit 349d2c58e5

View file

@ -99,7 +99,7 @@ SQLite::~SQLite()
void SQLite::isCache()
{
exec("pragma synchronous = off");
exec("pragma main.journal_mode = truncate");
exec("pragma main.journal_mode = wal");
}
void SQLite::exec(const std::string & stmt)