aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/gc.cc
AgeCommit message (Collapse)Author
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
2011-12-22* In the garbage collector, delete invalid paths before deletingEelco Dolstra
unreachable paths. This matters when using --max-freed etc.: unreachable paths could become reachable again, so it's nicer to keep them if there is "real" garbage to be deleted. Also, don't use readDirectory() but read the Nix store and delete invalid paths in parallel. This reduces GC latency on very large Nix stores.
2011-12-22* Drop unnecessary call to canonPath() (nixStore is already canonical).Eelco Dolstra
2011-08-31* Eliminate all uses of the global variable ‘store’ from libstore.Eelco Dolstra
This should also fix: nix-instantiate: ./../boost/shared_ptr.hpp:254: T* boost::shared_ptr<T>::operator->() const [with T = nix::StoreAPI]: Assertion `px != 0' failed. which was caused by hashDerivationModulo() calling the ‘store’ object (during store upgrades) before openStore() assigned it.
2010-10-14* Wrap deleteFromStore() in a transaction. Otherwise there might be aEelco Dolstra
race with other processes that add new referrers to a path, resulting in the garbage collector crashing with "foreign key constraint failed". (Nix/4) * Make --gc --print-dead etc. interruptible.
2010-08-31`nix-store --verify' improvements:Eelco Dolstra
* If a path has disappeared, check its referrers first, and don't try to invalidate paths that have valid referrers. Otherwise we get a foreign key constraint violation. * Read the whole Nix store directory instead of statting each valid path, which is slower. * Acquire the global GC lock.
2010-08-30* When using the build hook, distinguish between the stderr of theEelco Dolstra
hook script proper, and the stdout/stderr of the builder. Only the latter should be saved in /nix/var/log/nix/drvs. * Allow the verbosity to be set through an option. * Added a flag --quiet to lower the verbosity level.
2010-08-30* Disable the GC reachability check for now (when creating new roots),Eelco Dolstra
as it's hopelessly inefficient.
2010-03-08* Set `gc-keep-outputs' or `gc-keep-derivations' to false withEelco Dolstra
`--delete --ignore-liveness'.
2010-02-22* Get derivation outputs from the database instead of the .drv file,Eelco Dolstra
which requires more I/O.
2010-02-22* Revert r19650 (implement gc-keep-outputs by looking for derivationsEelco Dolstra
with the same name as the output) and instead use the DerivationOutputs table in the database, which is the correct way to to do things.
2010-02-02* Remove most Cygwin-specific code. Cygwin 1.7 implements advisoryEelco Dolstra
POSIX locks, and simulates Unix-style file deletion semantics sufficiently. Note that this means that Nix won't work on Cygwin 1.5 anymore.
2010-01-25* Make the garbage collector do the right thing when `gc-keep-outputs'Eelco Dolstra
is enabled by not depending on the deriver.
2009-11-24* Randomise the order in which we delete entries to make the collectorEelco Dolstra
less biased towards deleting paths that come alphabetically first (e.g. /nix/store/000...). This matters when using --max-freed etc.
2009-11-23(no commit message)Eelco Dolstra
2009-11-23* `nix-store --gc --print-roots': also print the path of the actualEelco Dolstra
root symlink, not just its target. E.g.: /nix/var/nix/profiles/system-99-link -> /nix/store/76kwf88657nq7wgk1hx3l1z5q91zb9wd-system
2009-11-23* Made the garbage collector a lot faster. It no longer computes theEelco Dolstra
complete set of live and dead paths before starting the actual deletion, but determines liveness on demand. I.e. for any path in the store, it first tries to delete all the referrers, and then the path itself. This means that the collector can start deleting paths almost immediately.
2009-11-20* Remove the --use-atime / --max-atime garbage collector flags. ManyEelco Dolstra
(Linux) machines no longer maintain the atime because it's too expensive, and on the machines where --use-atime is useful (like the buildfarm), reading the atimes on the entire Nix store takes way too much time to make it practical.
2009-04-21* Use foreach in a lot of places.Eelco Dolstra
2009-03-26* Don't use ULLONG_MAX in maxFreed - use 0 to mean "no limit".Eelco Dolstra
18446744073709551615ULL breaks on GCC 3.3.6 (`integer constant is too large for "long" type').
2008-12-12* Put chroots in the Nix store. This ensures that we can create hardEelco Dolstra
links to the inputs.
2008-12-12* Simplify deleting .lock files in /nix/store: just don't delete themEelco Dolstra
if they belong a path that's currently being built. This gets rid of some Cygwin-specific code.
2008-09-17* GC option `--max-atime' that specifies an upper limit to the lastEelco Dolstra
accessed time of paths that may be deleted. Anything more recently used won't be deleted. The time is specified in time_t, e.g. seconds since 1970-01-01 00:00:00 UTC; use `date +%s' to convert to time_t from the command line. Example: to delete everything that hasn't been used in the last two months: $ nix-store --gc -v --max-atime $(date +%s -d "2 months ago")
2008-09-17* Typo.Eelco Dolstra
2008-09-17* Some refactoring. Better output with `-v' for --use-atime.Eelco Dolstra
2008-09-17* Garbage collector: added an option `--use-atime' to delete paths inEelco Dolstra
order of ascending last access time. This is useful in conjunction with --max-freed or --max-links to prefer deleting non-recently used garbage, which is good (especially in the build farm) since garbage may become live again. The code could easily be modified to accept other criteria for ordering garbage by changing the comparison operator used by the priority queue in collectGarbage().
2008-08-14* Increase the sleep periods a bit to make the test less likely toEelco Dolstra
fail on slow machines. Of course it would be better if this test wasn't timing dependent...