aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/gc.cc
AgeCommit message (Collapse)Author
2015-03-06Fix typos: s/the the/the/Daniel Hahler
2014-12-12Ensure we're writing to stderr in the builderEelco Dolstra
http://hydra.nixos.org/build/17862041
2014-11-19Disable vacuuming the DB after garbage collectionEelco Dolstra
Especially in WAL mode on a highly loaded machine, this is not a good idea because it results in a WAL file of approximately the same size ad the database, which apparently cannot be deleted while anybody is accessing it.
2014-11-19Clean up temp roots in a more C++ wayEelco Dolstra
2014-11-04nix-store --gc: Don't warn about missing manifests directoryEelco Dolstra
2014-10-03Remove some duplicate codeEelco Dolstra
2014-08-20Use proper quotes everywhereEelco Dolstra
2014-08-13Use regular file GC roots if possibleEelco Dolstra
This makes hydra-eval-jobs create roots as regular files. See 1c208f2b7ef8ffb5e6d435d703dad83223a67bd6.
2014-08-01findRoots(): Prevent a call to lstat()Eelco Dolstra
This means that getting the roots from /nix/var/nix/.../hydra-roots doesn't need any I/O other than reading the directory.
2014-08-01Make readDirectory() return inode / file typeEelco Dolstra
2014-08-01Allow regular files as GC rootsEelco Dolstra
If a root is a regular file, then its name must denote a store path. For instance, the existence of the file /nix/var/nix/gcroots/per-user/eelco/hydra-roots/wzc3cy1wwwd6d0dgxpa77ijr1yp50s6v-libxml2-2.7.7 would cause /nix/store/wzc3cy1wwwd6d0dgxpa77ijr1yp50s6v-libxml2-2.7.7 to be a root. This is useful because it involves less I/O (no need for a readlink() call) and takes up less disk space (the symlink target typically takes up a full disk block, while directory entries are packed more efficiently). This is particularly important for hydra.nixos.org, which has hundreds of thousands of roots, and where reading the roots can take 25 minutes.
2014-03-30boost::shared_ptr -> std::shared_ptrEelco Dolstra
2014-02-27Set up a minimal /dev in chrootsEelco Dolstra
Not bind-mounting the /dev from the host also solves the problem with /dev/shm being a symlink to something not in the chroot.
2014-01-21Fix some clang warningsEelco Dolstra
2013-12-10Garbage collector: Release locks on temporary root filesEelco Dolstra
This allows processes waiting for such locks to proceed during the trash deletion phase of the garbage collector.
2013-11-14Remove nix-setuid-helperEelco Dolstra
AFAIK, nobody uses it, it's not maintained, and it has no tests.
2013-10-22For auto roots, show the intermediate linkEelco Dolstra
I.e. "nix-store -q --roots" will now show (for example) /home/eelco/Dev/nixpkgs/result rather than /nix/var/nix/gcroots/auto/53222qsppi12s2hkap8dm2lg8xhhyk6v
2013-07-12Garbage collector: Don't follow symlinks arbitrarilyEelco Dolstra
Only indirect roots (symlinks to symlinks to the Nix store) are now supported.
2013-04-26addAdditionalRoots(): Check each path only onceEelco Dolstra
2013-03-08Revert "Prevent config.h from being clobbered"Eelco Dolstra
This reverts commit 28bba8c44f484eae38e8a15dcec73cfa999156f6.
2013-03-07Prevent config.h from being clobberedEelco Dolstra
2013-01-05Delete a left-over trash directory before doing a GCEelco Dolstra
2013-01-04Fix "0 store paths deleted" messageEelco Dolstra
2013-01-03Clear any immutable bits in the Nix storeEelco Dolstra
Doing this once makes subsequent operations like garbage collecting more efficient since we don't have to call makeMutable() first.
2012-12-20Yet another rewrite of the garbage collectorEelco Dolstra
But this time it's *obviously* correct! No more segfaults due to infinite recursions for sure, etc. Also, move directories to /nix/store/trash instead of renaming them to /nix/store/bla-gc-<pid>. Then we can just delete /nix/store/trash at the end.
2012-12-19If gc-keep-derivations is set, only keep the actual deriverEelco Dolstra
This prevents zillions of derivations from being kept, and fixes an infinite recursion in the garbage collector (due to an obscure cycle that can occur with fixed-output derivations).
2012-09-19Templatise tokenizeString()Eelco Dolstra
2012-09-13Vacuum the SQLite DB after running the garbage collectorEelco Dolstra
2012-09-13Delete paths in a component in topologically sorted orderEelco Dolstra
The outputs of a derivation can refer to each other (even though they cannot have cycles), so they have to be deleted in the right order. http://hydra.nixos.org/build/3026118
2012-09-12Handle gc-keep-outputs and gc-keep-derivations both enabledEelco Dolstra
If the options gc-keep-outputs and gc-keep-derivations are both enabled, you can get a cycle in the liveness graph. There was a hack to handle this, but it didn't work with multiple-output derivations, causing the garbage collector to fail with errors like ‘error: cannot delete path `...' because it is in use by `...'’. The garbage collector now handles strongly connected components in the liveness graph as a unit and decides whether to delete all or none of the paths in an SCC.
2012-08-27Merge branch 'master' into no-manifestsEelco Dolstra
2012-08-05Handle amount of disk space saved by hard linking being negativeEelco Dolstra
Fixes bogus messages like "currently hard linking saves 17592186044416.00 MiB".
2012-08-01Count bytes freed deleting unused linksEelco Dolstra
2012-08-01Drop the block count in the garbage collectorEelco Dolstra
2012-08-01nix-store --gc: Make ‘--max-freed 0’ do the right thingEelco Dolstra
That is, delete almost nothing (it will still remove unused links from /nix/store/.links).
2012-08-01removeUnusedLinks(): Print stats on disk space saved by hard linkingEelco Dolstra
2012-07-30Refactor settings processingEelco Dolstra
Put all Nix configuration flags in a Settings object.
2012-07-23Garbage collect unused links in /nix/store/.linksEelco Dolstra
Incremental optimisation requires creating links in /nix/store/.links to all files in the store. However, this means that if we delete a store path, no files are actually deleted because links in /nix/store/.links still exists. So we need to check /nix/store/.links for files with a link count of 1 and delete them.
2012-04-16Fix obscure race condition in GC root creationEelco Dolstra
This should fix rare Hydra errors of the form: error: symlinking `/nix/var/nix/gcroots/per-user/hydra/hydra-roots/7sfhs5fdmjxm8sqgcpd0pgcsmz1kq0l0-nixos-iso-0.1pre33785-33795' to `/nix/store/7sfhs5fdmjxm8sqgcpd0pgcsmz1kq0l0-nixos-iso-0.1pre33785-33795': File exists
2012-03-26Mac OS X fixEelco Dolstra
2012-03-26Delete non-directory valid paths right awayEelco Dolstra
It's unlikely that rename() is faster than unlink() on a regular file or symlink, so don't bother.
2012-03-26Make the garbage collector more concurrentEelco Dolstra
Make the garbage collector more concurrent by deleting valid paths outside the region where we're holding the global GC lock. This should greatly reduce the time during which new builds are blocked, since the deletion accounts for the vast majority of the time spent in the GC. To ensure that this is safe, the valid paths are invalidated and renamed to some arbitrary path while we're holding the lock. This ensures that we when we finally delete the path, it's not a (newly) valid or locked path.
2012-03-26Remove the --max-links GC optionEelco Dolstra
We don't need this anymore now that current filesystems support more than 32,000 files in a directory.
2012-03-13Ensure that Perl processes delete their entry in the temproots directoryEelco Dolstra
By moving the destructor object to libstore.so, it's also run when download-using-manifests and nix-prefetch-url exit. This prevents them from cluttering /nix/var/nix/temproots with stale files.
2012-03-05Set the close-on-exec flag on file descriptorsEelco Dolstra
2012-02-15Don't use deletePath() to delete a single fileEelco Dolstra
2012-02-09Use data() instead of c_str() where appropriateEelco Dolstra
2011-12-30* Move topoSortPaths() out of gc.cc.Eelco Dolstra
2011-12-30* Reject a build if there is a cycle among the outputs. This isEelco Dolstra
necessary because existing code assumes that the references graph is acyclic.
2011-12-22* Oops.Eelco Dolstra