aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/gc.cc
AgeCommit message (Collapse)Author
2018-03-06rand() -> random(), since we use srandom().Will Dietz
rand() requires we call srand() instead, but might as well use random().
2018-02-01Remove obsolete references to manifestsEelco Dolstra
Closes #323.
2017-09-14Show the pid of temporary rootsEelco Dolstra
2017-09-14nix-store -q --roots / --gc --print-roots: Print temporary / in-memory rootsEelco Dolstra
For example, $ nix-store -q --roots /nix/store/7phd2sav7068nivgvmj2vpm3v47fd27l-patchelf-0.8pre845_0315148 {temp:1} denotes that the path is only being kept alive by a temporary root (i.e. /nix/var/nix/temproots/). Similarly, $ nix-store --gc --print-roots ... {memory:9} -> /nix/store/094gpjn9f15ip17wzxhma4r51nvsj17p-curl-7.53.1 shows that curl is being used by some process.
2017-09-06Fix abort when the GC thread gets an exceptionEelco Dolstra
2017-09-05Add automatic garbage collectionEelco Dolstra
Nix can now automatically run the garbage collector during builds or while adding paths to the store. The option "min-free = <bytes>" specifies that Nix should run the garbage collector whenever free space in the Nix store drops below <bytes>. It will then delete garbage until "max-free" bytes are available. Garbage collection during builds is asynchronous; running builds are not paused and new builds are not blocked. However, there also is a synchronous GC run prior to the first build/substitution. Currently, no old GC roots are deleted (as in "nix-collect-garbage -d").
2017-09-05GC: Don't delete own temproots fileEelco Dolstra
Since file locks are per-process rather than per-file-descriptor, the garbage collector would always acquire a lock on its own temproots file and conclude that it's stale.
2017-08-31Rename a few configuration optionsEelco Dolstra
In particular, drop the "build-" and "gc-" prefixes which are pointless. So now you can say nix build --no-sandbox instead of nix build --no-build-use-sandbox
2017-07-30Replace Unicode quotes in user-facing strings by ASCIIJörg Thalheim
Relevant RFC: NixOS/rfcs#4 $ ag -l | xargs sed -i -e "/\"/s/’/'/g;/\"/s/‘/'/g"
2017-07-04Support base-64 hashesEelco Dolstra
Also simplify the Hash API. Fixes #1437.
2017-05-16Improve progress indicatorEelco Dolstra
2017-04-24Remove debug statementEelco Dolstra
2017-04-20Detect lsofEelco Dolstra
Also, don't use lsof on Linux since it's not needed. Fixes #1328.
2017-04-10Minor cleanupEelco Dolstra
Also, possible fix for #1310 on 32-bit systems.
2017-01-16AutoCloseDir: Use std::unique_ptrEelco Dolstra
2016-12-08Don't delete .check directories of running buildsEelco Dolstra
We need to keep them around for diffoscope.
2016-11-26Revert "Get rid of unicode quotes (#1140)"Eelco Dolstra
This reverts commit f78126bfd6b6c8477fcdbc09b2f98772dbe9a1e7. There really is no need for such a massive change...
2016-11-25Get rid of unicode quotes (#1140)Guillaume Maudoux
2016-09-21printMsg(lvlError, ...) -> printError(...) etc.Eelco Dolstra
2016-07-21find-runtime-roots: fold into gc.ccShea Levy
2016-07-11Modernize AutoCloseFDShea Levy
2016-06-09Use O_CLOEXEC in most placesEelco Dolstra
2016-06-02LocalStore: Allow the physical and logical store directories to differEelco Dolstra
This is primarily to subsume the functionality of the copy-from-other-stores substituter. For example, in the NixOS installer, we can now do (assuming we're in the target chroot, and the Nix store of the installation CD is bind-mounted on /tmp/nix): $ nix-build ... --option substituters 'local?state=/tmp/nix/var&real=/tmp/nix/store' However, unlike copy-from-other-stores, this also allows write access to such a store. One application might be fetching substitutes for /nix/store in a situation where the user doesn't have sufficient privileges to create /nix, e.g.: $ NIX_REMOTE="local?state=/home/alice/nix/var&real=/home/alice/nix/store" nix-build ...
2016-06-02Allow setting the state directory as a store parameterEelco Dolstra
E.g. "local?store=/tmp/store&state=/tmp/var".
2016-06-01Make the store directory a member variable of StoreEelco Dolstra
2016-05-04More GC fixesEelco Dolstra
2016-04-25Fix "path is not in the Nix store" during GCEelco Dolstra
2016-04-25Improved logging abstractionEelco Dolstra
This also gets rid of --log-type, since the nested log type isn't useful in a multi-threaded situation, and nobody cares about the "pretty" log type.
2016-04-21Fix test failuresEelco Dolstra
2016-04-19Move path info caching from BinaryCacheStore to StoreEelco Dolstra
Caching path info is generally useful. For instance, it speeds up "nix path-info -rS /run/current-system" (i.e. showing the closure sizes of all paths in the closure of the current system) from 5.6s to 0.15s. This also eliminates some APIs like Store::queryDeriver() and Store::queryReferences().
2016-04-08Make LocalStore thread-safeEelco Dolstra
Necessary for multi-threaded commands like "nix verify-paths".
2016-02-24deletePath(): Succeed if path doesn't existEelco Dolstra
Also makes it robust against concurrent deletions.
2016-02-24Eliminate reserveSpace flagEelco Dolstra
2016-02-11Move addPermRoot into StoreEelco Dolstra
2016-02-04StoreAPI -> StoreEelco Dolstra
Calling a class an API is a bit redundant...
2016-02-04Eliminate the "store" global variableEelco Dolstra
Also, move a few free-standing functions into StoreAPI and Derivation. Also, introduce a non-nullable smart pointer, ref<T>, which is just a wrapper around std::shared_ptr ensuring that the pointer is never null. (For reference-counted values, this is better than passing a "T&", because the latter doesn't maintain the refcount. Usually, the caller will have a shared_ptr keeping the value alive, but that's not always the case, e.g., when passing a reference to a std::thread via std::bind.)
2015-07-17OCD: foreach -> C++11 ranged forEelco Dolstra
2015-06-30GC: Handle ENOSPC creating/moving to the trash directoryEelco Dolstra
Issue #564.
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