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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user