-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Short-circuit computeFSClosure when copying #14569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Discussed in the nix maintainer coworking call. My summary:
(1) shouldn't block this PR, but for (2) we should test the opposite case and choose what to do based on the results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C API could be extended when the need arises. Now seems premature, so this impl-only change looks perfect to me.
re (2): I didn't test it because tbh I don't know how to artificially create a "slow destination." But I'm fairly confident this is a strict improvement. The code path currently is:
So today it's always doing 2N queries before transferring any NARs. With this PR that is strictly lower. Maybe there is some cost in context switching between the two, but I don't think it's consequential. As an alternative implementation, I was thinking about implementing a separate |
xokdvium
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small comment. Also Eelcos concern seems valid, though it only affects the legacy ssh store case.
293230b to
5d13b86
Compare
Motivation
Copying closures between devices currently requires resolving the full closure on the "source" store. This is usually fast because the path info is cached, but for devices which are infrequently updated (so the cache is expired) this can add a significant amount of unnecessary work.
This PR adds a callback to
computeFSClosurethat allows it to short-circuit, and then uses it fromcopyClosureto query only the set of missing paths. I tested this by deleting my narinfo cache & downloading a closure from HTTP cache with 1442 paths, where 1396 of those paths were already available locally.Before this PR it took 5m 14s, where resolving all the
*.narinfofiles took ~4 minutes before any download started.After this PR it took 1m 12s, with downloads starting essentially instantly.
Context
I am working through the C API, but it would be great if this also applied to the
nix copyCLI, but it's a pretty different code path that made this PR a lot more complicated.Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.