aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/gc.cc
AgeCommit message (Collapse)Author
2022-03-17gc: don't visit implicit referrers on garbage collectionSergei Trofimovich
Before the change garbage collector was not considering `.drv` and outputs as alive even if configuration says otherwise. As a result `nix store gc --dry-run` could visit (and parse) `.drv` files multiple times (worst case it's quadratic). It happens because `alive` set was populating only runtime closure without regard for actual configuration. The change fixes it. Benchmark: my system has about 139MB, 40K `.drv` files. Performance before the change: $ time nix store gc --dry-run real 4m22,148s Performance after the change: $ time nix store gc --dry-run real 0m14,178s
2022-03-13nix store gc: account for auto-optimised storeSergei Trofimovich
Before the change on a system with `auto-optimise-store = true`: $ nix store gc --verbose --max 1 deleted all the paths instead of one path (we requested 1 byte limit). It happens because every file in `auto-optimise-store = true` has at least 2 links: file itself and a link in /nix/store/.links/ directory. The change conservatively assumes that any file that has one (as before) or two links (assume auto-potimise mode) will free space. Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2022-02-28Fix Darwin buildEelco Dolstra
Fixes #6169
2022-02-25Remove std::string alias (for real this time)Eelco Dolstra
Also use std::string_view in a few more places.
2021-12-13More debug infoEelco Dolstra
2021-12-13Retry on ECONNREFUSEDEelco Dolstra
https://hydra.nixos.org/build/161439235
2021-12-13Explicitly make GC roots client sockets blockingEelco Dolstra
On macOS / BSD, these sockets inherit the non-blocking flag of the server soocket, which is not what we want. https://github.com/dotnet/runtime/issues/25069 https://bugs.python.org/issue7995 https://hydra.nixos.org/build/161439304
2021-11-22Unify #if linuxAlex Shabalin
2021-11-19Fix build warnings on MacOSAlex Shabalin
2021-10-28Use nix::connect() to connect to the garbage collectorEelco Dolstra
2021-10-28Remove unused variableEelco Dolstra
2021-10-15Add a test for the non-blocking GCEelco Dolstra
2021-10-15Fix main GC thread exitingEelco Dolstra
2021-10-15Fix crash when a GC client disconnectsEelco Dolstra
The client thread can't just delete its own thread object from connections, it has to detach it.
2021-10-15Memoize queryReferrers()Eelco Dolstra
2021-10-14Speed up GC by marking entire closures as liveEelco Dolstra
2021-10-14Remove GCStateEelco Dolstra
2021-10-14Move deleteFromStore()Eelco Dolstra
2021-10-14Make the canReachRoots() traversal non-recursiveEelco Dolstra
2021-10-13Fix GC when there are cycles in the referrers graphEelco Dolstra
(where "referrers" includes the reverse of derivation outputs and derivers). Now we do a full traversal to look if we can reach any root. If not, all paths reached can be deleted.
2021-10-13SimplifyEelco Dolstra
2021-10-13Use a thread per connectionEelco Dolstra
2021-10-13Fix auto-gcEelco Dolstra
2021-10-13Non-blocking garbage collectorEelco Dolstra
The garbage collector no longer blocks other processes from adding/building store paths or adding GC roots. To prevent the collector from deleting store paths just added by another process, processes need to connect to the garbage collector via a Unix domain socket to register new temporary roots.
2021-10-13Remove syncWithGC()Eelco Dolstra
2021-10-13Remove trash directoryEelco Dolstra
2021-06-18UDSRemoteStore: Support the 'root' store parameterEelco Dolstra
Useful when we're using a daemon with a chroot store, e.g. $ NIX_DAEMON_SOCKET_PATH=/tmp/chroot/nix/var/nix/daemon-socket/socket nix-daemon --store /tmp/chroot Then the client can now connect with $ nix build --store unix:///tmp/chroot/nix/var/nix/daemon-socket/socket?root=/tmp/chroot nixpkgs#hello
2020-10-12Handle amount of disk space saved by hard linking being negativevolth
Fixes bogus messages like "currently hard linking saves 17592186044416.00 MiB".
2020-10-09Split out `local-fs-store.hh`John Ericson
This matches the already-existing `local-fs-store.cc`.
2020-09-23lstat() cleanupEelco Dolstra
2020-09-17Fix garbage collection of CA derivationsregnat
Fix #4026
2020-09-03Remove gc-check-reachabilityEelco Dolstra
2020-09-03addPermRoot(): Remove indirect flagEelco Dolstra
2020-07-30unsigned long long -> uint64_tEelco Dolstra
2020-07-13toStorePath(): Return a StorePath and the suffixEelco Dolstra
2020-06-16Remove StorePath::clone() and related functionsEelco Dolstra
2020-06-15Get rid of explicit ErrorInfo constructorsEelco Dolstra
2020-05-13formatting and a few minor changesBen Burdette
2020-05-13consistent capitalizationBen Burdette
2020-05-13change status messages to info levelBen Burdette
2020-05-11Merge branch 'master' into errors-phase-2Ben Burdette
2020-05-06todo removalBen Burdette
2020-05-06Merge pull request #3546 from guibou/nix_readfile_on_0_sized_filesEelco Dolstra
builtins.readFile: do not truncate content
2020-05-04nix auto-gc: use fragment sizeJude Taylor
2020-05-01convert some errorsBen Burdette
2020-04-29Remove the `drain` argument from `readFile`Guillaume Bouchard
Now it is always `drain` (see previous commit).
2020-04-21remove 'format' from Error constructor callsBen Burdette
2020-04-09gc.cc: Ignore hidden files in temprootsPhilipp Middendorf
2020-02-28Fix GC failures on bad store path namesEelco Dolstra
It failed on names like '/nix/store/9ip48nkc9rfy0a4yaw98lp6gipqlib1a-'.
2020-01-05build: fix sandboxing on darwinDaiderd Jordan
Starting ba87b08f8529e4d9f8c58d8c625152058ceadb75 getEnv now returns an std::optional which means these getEnv() != "" conditions no longer happen if the variables are not defined.