Repository navigation
Add support for build-dir artifact duplication #17512
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?
Changes from all commits
2801d3d
dd8653b
3e4fa5b
3388a9b
24dc824
8613c57
2bd6662
d13ab44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Just FYI, you might want to paste raw markdown table instead of images. |
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Summary of open threadsSince this PR has a lot of open threads, its getting a bit difficult to navigate in GitHub. I want to call out some of the threads here:
Let me know if I missed any important design decisions.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,6 +101,7 @@ Each new feature described below should explain how to use it. | |
| * [json-target-spec](#json-target-spec) --- Allows the use of `.json` custom target specs. | ||
| * [hint-msrv](#hint-msrv) --- Allows Cargo to set `-Zhint-msrv` | ||
| * [mem-stats](#mem-stats) --- Reports peak memory usage per build unit in `--timings`. | ||
| * [shared-object-storage](#shared-object-storage) --- Deduplicates build artifacts between workspaces | ||
| * rustdoc | ||
| * [rustdoc-map](#rustdoc-map) --- Provides mappings for documentation to link to external sites like [docs.rs](https://docs.rs/). | ||
| * [scrape-examples](#scrape-examples) --- Shows examples within documentation. | ||
|
|
@@ -2029,6 +2030,24 @@ option: | |
| hint-msrv = true | ||
| ``` | ||
|
|
||
| ## shared-object-storage | ||
| * Tracking Issue: [rust-lang/cargo#17453](https://github.com/rust-lang/cargo/issues/17453) | ||
|
|
||
| Enables Cargo to automatically deduplicate files across build units and workspaces by hardlink/reflinking | ||
| against a shared content addressable object storage located in `~/.cargo/storage`. | ||
|
|
||
| You can set this via your global `~/.cargo/config.toml`, and nightly Cargo will | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just wonder, should we mention
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the following snippet: Note that some configuration options can improve or degrade the storage reduction rate.
A notable example of this [`profile.trim-paths`](profiles.md#trim-paths) which helps by reducing the number of absolute paths in compiler outputs making more deduplication possible. |
||
| automatically use it, while stable Cargo will silently ignore the unstable | ||
| option: | ||
|
|
||
| ```toml | ||
| [unstable] | ||
| shared-object-storage = true | ||
| ``` | ||
|
|
||
| Note that some configuration options can improve or degrade the storage reduction rate. | ||
| A notable example of this [`profile.trim-paths`](profiles.md#trim-paths) which helps by reducing the number of absolute paths in compiler outputs making more deduplication possible. | ||
|
|
||
| ## builtin-dependencies | ||
| * Tracking Issue: [rust-lang/cargo#16960](https://github.com/rust-lang/cargo/issues/16960) | ||
| - RFC: [rust-lang/rfcs#3875](https://rust-lang.github.io/rfcs/3875-build-std-explicit-dependencies.html) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,6 +131,15 @@ pub fn cli() -> Command { | |
| ) | ||
| .value_name("SIZE") | ||
| .value_parser(parse_human_size), | ||
| ) | ||
| .arg( | ||
| opt( | ||
| "max-shared-storage-age", | ||
| "Deletes any shared object data that has not been used \ | ||
| since the given age (unstable)", | ||
| ) | ||
| .value_name("DURATION") | ||
| .value_parser(parse_time_span), | ||
|
Comment on lines
+135
to
+142
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Somewhere where we can track details on this: pure-age based GC will likely not be a good idea. If something is unused for 6 months, then yes, let's delete it. Maybe for someone who always does But for people who are doing heavy AI use, we'll likely also need "only keep the latest 30 entries" or something.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, the best strategy here is tricky. |
||
| ), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (arbitrary location) Looking at yet another If we stabilized this as-is, users will keep running
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah... that is a good point. one could make a reasonable argument that we should always run shared storage GC on
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Perhaps one other alternative is when we have stable Though, I would rather always GC when running
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Tbh, I agree with this.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally, we clean up orphaned files. The question then becomes how to detect orphans.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the GC algorithm I implemented should detect orphans.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This detects when something is orphaned by snapshots. What I am talking about is when something is orphaned by a
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm yeah good point. The questions I have is: What should we do if an object is orphaned by I think the answer is to discard the snapshot since the object being orphaned means this snapshot must not be in use anymore. |
||
| ) | ||
| .after_help(color_print::cstr!( | ||
|
|
@@ -200,13 +209,14 @@ fn gc(gctx: &GlobalContext, args: &ArgMatches) -> CliResult { | |
| max_crate_size: size_opt("max-crate-size"), | ||
| max_git_size: size_opt("max-git-size"), | ||
| max_download_size: size_opt("max-download-size"), | ||
| max_shared_storage_age: duration_opt("max-shared-storage-age"), | ||
| }; | ||
| if let Some(age) = duration_opt("max-download-age") { | ||
| gc_opts.set_max_download_age(age); | ||
| } | ||
| // If the user sets any options, then only perform the options requested. | ||
| // If no options are set, do the default behavior. | ||
| if !gc_opts.is_download_cache_opt_set() { | ||
| if !gc_opts.is_download_cache_opt_set() && !gc_opts.is_shared_storage_opt_set() { | ||
| gc_opts.update_for_auto_gc(gctx)?; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.