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

[perf] Add flag to fix missing store paths #2102

Merged
merged 5 commits into from
Jun 6, 2024
Merged

Conversation

mikeland73
Copy link
Contributor

@mikeland73 mikeland73 commented May 29, 2024

Summary

Adds new --tidy-lockfile flag that can be used with install. It fills in any missing store paths in lockfile, improving future performance.

I'm not 100% convinced this works in all cases. My two biggest concerns would be:

  • I'm setting all outputs to default.
  • re derivation name parsing: Not 100% sure we can rely on versions never having dashes.

How was it tested?

  • unit test
  • Manually removed store paths form lockfile and tried to install. Got warning, ran with flag.

@mikeland73 mikeland73 requested review from gcurtis and savil May 29, 2024 22:57
@mikeland73 mikeland73 requested a review from Lagoja June 4, 2024 21:00
@mikeland73
Copy link
Contributor Author

@Lagoja @gcurtis made updates we talked about:

  • Better copy when missing store paths.
  • Only show message for devbox packages (i.e. pkg@version)
  • Fix store paths on update

@Lagoja
Copy link
Contributor

Lagoja commented Jun 4, 2024

Running this, I get:

Warning: Outputs for libiconv@latest are not in lockfile. Fetching store paths from nix
To fix this issue and improve performance, please run `devbox install --fix-missing-store-paths

Are we fetching the store paths at the time that I get this message? Or do I need to run the command with the flag

// No fast path, we need to query nix.
ux.Fwarning(
w,
"Outputs for %s are not in lockfile. Fetching store paths from nix\n"+
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Outputs for %s are not in lockfile. Fetching store paths from nix\n"+
"Outputs for %s are not in lockfile.+

@mikeland73
Copy link
Contributor Author

@Lagoja I need to hide the message when using the flag. Will do.

Copy link
Collaborator

@gcurtis gcurtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we name the flag --tidy-lockfile? Are missing store paths in the lockfile a problem? I thought it just made things slower.

Path: storePath,
Name: parts.Output,
// Ugh, not sure this is true, but it's more true than not.
Default: true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the downside if this ends up being wrong?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not much. We may install a bit more than we're supposed to (on the other hand, if we forget to add this value, that's bad).

@mikeland73
Copy link
Contributor Author

Should we name the flag --tidy-lockfile? Are missing store paths in the lockfile a problem? I thought it just made things slower.

I like that name. Will change. It gives us flexibility to do more stuff.

missing store paths from lockfile can be a big perf drag, especially if all packages are in cache. If the store paths are missing we end up having to download nixpkgs every time (which adds 40s for each nixpkgs). Particularly painful on CICD because env is fresh every time.

@mikeland73 mikeland73 merged commit 3bb13c1 into main Jun 6, 2024
24 checks passed
@mikeland73 mikeland73 deleted the landau/add-store-paths branch June 6, 2024 01:49
Copy link

sentry-io bot commented Jun 6, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

Did you find this useful? React with a 👍 or 👎

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.

3 participants