about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-16T12·36+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-16T12·36+0200
commitbce14d0f61801f0f1c3080970619e2ca11683a4e (patch)
treee1b5df5a0dd8fc566a9d298c4b5efe6eac84a601
parent7cdefdbe732c209e13f234eb71022791909a5518 (diff)
Don't wrap read-only queries in a transaction
There is no risk of getting an inconsistent result here: if the ID
returned by queryValidPathId() is deleted from the database
concurrently, subsequent queries involving that ID will simply fail
(since IDs are never reused).
-rw-r--r--src/libstore/local-store.cc6
1 files changed, 0 insertions, 6 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 7f7f70bb8857..f88af10f7ae9 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -929,8 +929,6 @@ PathSet LocalStore::queryValidDerivers(const Path & path)
 
 PathSet LocalStore::queryDerivationOutputs(const Path & path)
 {
-    SQLiteTxn txn(db);
-
     SQLiteStmtUse use(stmtQueryDerivationOutputs);
     stmtQueryDerivationOutputs.bind(queryValidPathId(path));
 
@@ -951,8 +949,6 @@ PathSet LocalStore::queryDerivationOutputs(const Path & path)
 
 StringSet LocalStore::queryDerivationOutputNames(const Path & path)
 {
-    SQLiteTxn txn(db);
-
     SQLiteStmtUse use(stmtQueryDerivationOutputs);
     stmtQueryDerivationOutputs.bind(queryValidPathId(path));
 
@@ -975,8 +971,6 @@ Path LocalStore::queryPathFromHashPart(const string & hashPart)
 {
     if (hashPart.size() != 32) throw Error("invalid hash part");
 
-    SQLiteTxn txn(db);
-
     Path prefix = settings.nixStore + "/" + hashPart;
 
     SQLiteStmtUse use(stmtQueryPathFromHashPart);