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
Make the TTL for disk cache configurable #2036
Conversation
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.
Can you add a section in the manual about these options? Also, if possible some clarification in the help text on what "negative" and "positive" mean might help.
@shlevy yeah sure |
@shlevy done let me know if anything should be modified/added. |
Well setting |
doc/manual/command-ref/conf-file.xml
Outdated
|
||
<listitem> | ||
|
||
<para>The TTL in seconds for negative lookups. If a store path is queried from a substituer but |
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.
=> substituter
.
doc/manual/command-ref/conf-file.xml
Outdated
|
||
<listitem> | ||
|
||
<para>The TTL in seconds for positive lookups. If a store path is queried from a substituer, the result of |
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.
=> substituter
.
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.
oops.
doc/manual/command-ref/conf-file.xml
Outdated
<para>The TTL in seconds for positive lookups. If a store path is queried from a substituer, the result of | ||
the query will be cached in the local disk cache database including some of the NAR metadata. Setting a TTL | ||
for positive lookups can be useful in case of builds that aren't reproducible, in which case having a more | ||
frequent cache invalidation would prevent hash mismatch issues.</para> |
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.
`Setting a TTL..." implies that there is no TTL by default, which is not the case. Would be better to say something like "The defautl TTL is bla bla. Setting a shorter TTL can be useful in case...".
BTW this scenario may not be completely clear. I assume this is when the binary cache has frequent garbage collections (in which case it doesn't really matter whether the builds are reproducible).
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.
@edolstra yeah that's also another case where this is useful, I'll mention that instead.
src/libstore/globals.hh
Outdated
@@ -313,6 +313,14 @@ public: | |||
Setting<Strings> trustedUsers{this, {"root"}, "trusted-users", | |||
"Which users or groups are trusted to ask the daemon to do unsafe things."}; | |||
|
|||
Setting<unsigned int> ttlNegativeDiskCache{this, 3600, "negative-disk-cache-ttl", |
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 more thing: "disk cache" is a bit ambiguous as there can be many disk cache (e.g. nix search
also has a disk cache). Maybe it should be called narinfo cache
(e.g. narinfo-cache-negative-ttl
).
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.
sounds good
disk cache lookup for example by doing: nix copy --from <binary-cahe> <store-path> --option \ positive-disk-cache-ttl 0 Issues: NixOS#1885 NixOS#2035
…mple in the positive lookup case
…d all over the place for other operations
6847776
to
62d75ad
Compare
@edolstra options name updated. |
This should allow modifying the disk cache TTL or completely disabling it to force another binary cache query.