aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc66
1 files changed, 7 insertions, 59 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 31aee0dd1..c928e7cb6 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -198,6 +198,13 @@ LocalStore::LocalStore()
txn.commit();
}
+ if (curSchema < 9) {
+ SQLiteTxn txn(state->db);
+ if (sqlite3_exec(state->db, "drop table FailedPaths", 0, 0, 0) != SQLITE_OK)
+ throwSQLiteError(state->db, "upgrading database schema");
+ txn.commit();
+ }
+
writeFile(schemaPath, (format("%1%") % nixSchemaVersion).str());
lockFile(globalLock, ltRead, true);
@@ -327,16 +334,6 @@ void LocalStore::openDB(State & state, bool create)
"select path from Refs join ValidPaths on referrer = id where reference = (select id from ValidPaths where path = ?);");
state.stmtInvalidatePath.create(db,
"delete from ValidPaths where path = ?;");
- state.stmtRegisterFailedPath.create(db,
- "insert or ignore into FailedPaths (path, time) values (?, ?);");
- state.stmtHasPathFailed.create(db,
- "select time from FailedPaths where path = ?;");
- state.stmtQueryFailedPaths.create(db,
- "select path from FailedPaths;");
- // If the path is a derivation, then clear its outputs.
- state.stmtClearFailedPath.create(db,
- "delete from FailedPaths where ?1 = '*' or path = ?1 "
- "or path in (select d.path from DerivationOutputs d join ValidPaths v on d.drv = v.id where v.path = ?1);");
state.stmtAddDerivationOutput.create(db,
"insert or replace into DerivationOutputs (drv, id, path) values (?, ?, ?);");
state.stmtQueryValidDerivers.create(db,
@@ -583,55 +580,6 @@ uint64_t LocalStore::addValidPath(State & state,
}
-void LocalStore::registerFailedPath(const Path & path)
-{
- retrySQLite<void>([&]() {
- auto state(_state.lock());
- state->stmtRegisterFailedPath.use()(path)(time(0)).step();
- });
-}
-
-
-bool LocalStore::hasPathFailed(const Path & path)
-{
- return retrySQLite<bool>([&]() {
- auto state(_state.lock());
- return state->stmtHasPathFailed.use()(path).next();
- });
-}
-
-
-PathSet LocalStore::queryFailedPaths()
-{
- return retrySQLite<PathSet>([&]() {
- auto state(_state.lock());
-
- auto useQueryFailedPaths(state->stmtQueryFailedPaths.use());
-
- PathSet res;
- while (useQueryFailedPaths.next())
- res.insert(useQueryFailedPaths.getStr(0));
-
- return res;
- });
-}
-
-
-void LocalStore::clearFailedPaths(const PathSet & paths)
-{
- retrySQLite<void>([&]() {
- auto state(_state.lock());
-
- SQLiteTxn txn(state->db);
-
- for (auto & path : paths)
- state->stmtClearFailedPath.use()(path).exec();
-
- txn.commit();
- });
-}
-
-
Hash parseHashField(const Path & path, const string & s)
{
string::size_type colon = s.find(':');