Vacuum the SQLite DB after running the garbage collector
This commit is contained in:
parent
2923b55f9d
commit
e6e495649c
3 changed files with 12 additions and 0 deletions
|
@ -740,6 +740,9 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
|
|||
printMsg(lvlError, format("deleting unused links..."));
|
||||
removeUnusedLinks(state);
|
||||
}
|
||||
|
||||
/* While we're at it, vacuum the database. */
|
||||
if (options.action == GCOptions::gcDeleteDead) vacuumDB();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1703,4 +1703,11 @@ void LocalStore::upgradeStore6()
|
|||
}
|
||||
|
||||
|
||||
void LocalStore::vacuumDB()
|
||||
{
|
||||
if (sqlite3_exec(db, "vacuum;", 0, 0, 0) != SQLITE_OK)
|
||||
throwSQLiteError(db, "vacuuming SQLite database");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -195,6 +195,8 @@ public:
|
|||
|
||||
void clearFailedPaths(const PathSet & paths);
|
||||
|
||||
void vacuumDB();
|
||||
|
||||
private:
|
||||
|
||||
Path schemaPath;
|
||||
|
|
Loading…
Reference in a new issue