Skip to content
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

Revert "[perf] Skip cache check if store path exists locally" #2054

Merged
merged 1 commit into from
May 15, 2024

Conversation

mikeland73
Copy link
Contributor

Reverts #2042

#2042 introduced a bug where adding non-cached packages would fail to add them to the flake on the first attempt. (it would succeed on subsequent attempts after the package is already in the store).

The root cause is that fetchNarInfoStatus gets called twice per package (even though we cache it and we're not supposed to call it twice). The first call returns false because the package is not cached. The second call returns true because the package is already in store. This discrepancy essentially causes the package not to appear on the flake at all. When updating state again, the package is already in the nix store so both fetchNarInfoStatus calls return true.

I think reverting this is best immediate course of action. In follow up we should fix fetchNarInfoStatus so it only gets called once (it will improve performance and is more correct).

Later on we can think of better way to do #2042. The current implementation is a bit fragile and not 100% consistent with the initial intention of the function, so I'm concerned it can lead to more bugs in the future.

@mikeland73 mikeland73 requested review from savil and gcurtis May 15, 2024 06:11
@mikeland73 mikeland73 merged commit 132ad46 into main May 15, 2024
24 checks passed
@mikeland73 mikeland73 deleted the revert-2042-landau/skip-cache-check branch May 15, 2024 15:45
mikeland73 added a commit that referenced this pull request May 16, 2024
## Summary

Fixes bug described here #2054

A better (but a bit more involved) solution is to parallelize by output.
Currently we parallelize by meta-output (which includes
`__default_output__`). This has two downsides:

* `__default_output__` can be multiple outputs, in which case we don't
parallelize them at all.
* We still do redundant work when `__default_output__` is multiple
outputs. (once as `__default_output__` and once for each individual
outout that forms part of defaults).

## How was it tested?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants