mirror of
https://github.com/NixOS/nix.git
synced 2025-11-18 00:12:43 +01:00
Merge remote-tracking branch 'upstream/master' into overlayfs-store
This commit is contained in:
commit
73c9fc7ab1
19 changed files with 224 additions and 186 deletions
|
|
@ -1593,8 +1593,21 @@ bool LocalStore::verifyStore(bool checkContents, RepairFlag repair)
|
|||
|
||||
bool LocalStore::verifyAllValidPaths(RepairFlag repair, StorePathSet & validPaths)
|
||||
{
|
||||
StringSet store;
|
||||
for (auto & i : readDirectory(realStoreDir)) store.insert(i.name);
|
||||
StorePathSet storePathsInStoreDir;
|
||||
/* Why aren't we using `queryAllValidPaths`? Because that would
|
||||
tell us about all the paths than the database knows about. Here we
|
||||
want to know about all the store paths in the store directory,
|
||||
regardless of what the database thinks.
|
||||
|
||||
We will end up cross-referencing these two sources of truth (the
|
||||
database and the filesystem) in the loop below, in order to catch
|
||||
invalid states.
|
||||
*/
|
||||
for (auto & i : readDirectory(realStoreDir)) {
|
||||
try {
|
||||
storePathsInStoreDir.insert({i.name});
|
||||
} catch (BadStorePath &) { }
|
||||
}
|
||||
|
||||
/* Check whether all valid paths actually exist. */
|
||||
printInfo("checking path existence...");
|
||||
|
|
@ -1603,7 +1616,7 @@ bool LocalStore::verifyAllValidPaths(RepairFlag repair, StorePathSet & validPath
|
|||
bool errors = false;
|
||||
|
||||
auto existsInStoreDir = [&](const StorePath & storePath) {
|
||||
return store.count(std::string(storePath.to_string()));
|
||||
return storePathsInStoreDir.count(storePath);
|
||||
};
|
||||
|
||||
for (auto & i : queryAllValidPaths())
|
||||
|
|
@ -1620,8 +1633,6 @@ void LocalStore::verifyPath(const StorePath & path, std::function<bool(const Sto
|
|||
|
||||
if (!done.insert(path).second) return;
|
||||
|
||||
auto pathS = printStorePath(path);
|
||||
|
||||
if (!existsInStoreDir(path)) {
|
||||
/* Check any referrers first. If we can invalidate them
|
||||
first, then we can invalidate this path as well. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue