about summary refs log tree commit diff
path: root/src/libstore/gc.cc (follow)
AgeCommit message (Collapse)AuthorFilesLines
2012-07-30 Refactor settings processingEelco Dolstra1-39/+39
Put all Nix configuration flags in a Settings object.
2012-07-23 Garbage collect unused links in /nix/store/.linksEelco Dolstra1-0/+37
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-16 Fix obscure race condition in GC root creationEelco Dolstra1-16/+18
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-26 Mac OS X fixEelco Dolstra1-0/+3
2012-03-26 Delete non-directory valid paths right awayEelco Dolstra1-16/+27
It's unlikely that rename() is faster than unlink() on a regular file or symlink, so don't bother.
2012-03-26 Make the garbage collector more concurrentEelco Dolstra1-11/+42
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-26 Remove the --max-links GC optionEelco Dolstra1-11/+1
We don't need this anymore now that current filesystems support more than 32,000 files in a directory.
2012-03-13 Ensure that Perl processes delete their entry in the temproots directoryEelco Dolstra1-0/+12
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-05 Set the close-on-exec flag on file descriptorsEelco Dolstra1-0/+1
2012-02-15 Don't use deletePath() to delete a single fileEelco Dolstra1-1/+1
2012-02-09 Use data() instead of c_str() where appropriateEelco Dolstra1-1/+1
2011-12-30 * Move topoSortPaths() out of gc.cc.Eelco Dolstra1-36/+0
2011-12-30 * Reject a build if there is a cycle among the outputs. This isEelco Dolstra1-4/+10
necessary because existing code assumes that the references graph is acyclic.
2011-12-22 * Oops.Eelco Dolstra1-1/+1
2011-12-22 * In the garbage collector, delete invalid paths before deletingEelco Dolstra1-11/+35
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 Dolstra1-1/+1
2011-08-31 * Eliminate all uses of the global variable ‘store’ from libstore.Eelco Dolstra1-24/+24
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 Dolstra1-3/+5
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 Dolstra1-2/+1
* 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 Dolstra1-1/+1
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 Dolstra1-1/+1
as it's hopelessly inefficient.
2010-03-08 * Set `gc-keep-outputs' or `gc-keep-derivations' to false withEelco Dolstra1-0/+9
`--delete --ignore-liveness'.
2010-02-22 * Get derivation outputs from the database instead of the .drv file,Eelco Dolstra1-4/+4
which requires more I/O.
2010-02-22 * Revert r19650 (implement gc-keep-outputs by looking for derivationsEelco Dolstra1-53/+3
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 Dolstra1-38/+0
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 Dolstra1-18/+69
is enabled by not depending on the deriver.
2009-11-24 * Randomise the order in which we delete entries to make the collectorEelco Dolstra1-2/+10
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 Dolstra1-0/+5
2009-11-23 * `nix-store --gc --print-roots': also print the path of the actualEelco Dolstra1-5/+0
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 Dolstra1-161/+162
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 Dolstra1-131/+5
(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 Dolstra1-20/+12
2009-03-26 * Don't use ULLONG_MAX in maxFreed - use 0 to mean "no limit".Eelco Dolstra1-1/+1
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 Dolstra1-0/+5
links to the inputs.
2008-12-12 * Simplify deleting .lock files in /nix/store: just don't delete themEelco Dolstra1-30/+18
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 Dolstra1-6/+12
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 Dolstra1-1/+1
2008-09-17 * Some refactoring. Better output with `-v' for --use-atime.Eelco Dolstra1-33/+35
2008-09-17 * Garbage collector: added an option `--use-atime' to delete paths inEelco Dolstra1-37/+157
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 Dolstra1-4/+0
fail on slow machines. Of course it would be better if this test wasn't timing dependent...
2008-06-18 * Garbage collector: option `--max-freed' to stop after at least NEelco Dolstra1-2/+23
bytes have been freed, `--max-links' to stop when the Nix store directory has fewer than N hard links (the latter being important for very large Nix stores on filesystems with a 32000 subdirectories limit).
2008-06-18 * Some refactoring: put the GC options / results in separate structs.Eelco Dolstra1-28/+26
* The garbage collector now also prints the number of blocks freed.
2008-06-14 * Note.Eelco Dolstra1-1/+5
2008-06-13 * Garbage collector: don't do a complete topological sort of the NixEelco Dolstra1-74/+83
store under the reference relation, since that means that the garbage collector will need a long time to start deleting paths. Instead just delete the referrers of a path first.
2008-06-13 * Print some progress info during the early GC stages.Eelco Dolstra1-0/+8
2008-06-09 * Merged the no-bdb branch (-r10900:HEADEelco Dolstra1-2/+0
https://svn.nixos.org/repos/nix/nix/branches/no-bdb).
2007-11-29 * nix-env -e: support uninstalling by path, so that one can sayEelco Dolstra1-5/+4
$ nix-env -e $(which firefox) or $ nix-env -e /nix/store/nywzlygrkfcgz7dfmhm5xixlx1l0m60v-pan-0.132 * nix-env -i: if an argument contains a slash anywhere, treat it as a path and follow it through symlinks into the Nix store. This allows things like $ nix-build -A firefox $ nix-env -i ./result * nix-env -q/-i/-e: don't complain when the `*' selector doesn't match anything. In particular, `nix-env -q \*' doesn't fail anymore on an empty profile.
2007-11-15 * Don't need gc.hh.Eelco Dolstra1-1/+2
2007-11-15 Added possibility to specify garbage collection levels for store paths; so ↵Michael Raskin1-4/+15
packages can share intermediate results of compilation and GC will collect it automatically while never touching tarballs, for example.
2007-08-28 * PathLocks::lockPaths: don't allow reacquiring a lock we alreadyEelco Dolstra1-1/+3
hold.