-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Tracking Issue for serving an index over HTTP #9069
Comments
Use specific terminology for sparse HTTP-based registry Before the options is popularized, I'd like to take opportunity to give it a unique name used consistently. It's been called "http" registry, but that's a rather generic term, especially that existing git-based registry also uses HTTP as its transport. New registry URLs use `sparse+https://` prefix, so calling it "sparse" registry seems more appropriate. #9069
Hey, would this mean that when |
It doesn't address this problem. There is still going to be a delay between |
@mightyiam #9507 is the issue you want to be following. For background, publishing a crate used to be a blocking operation but to speed up crates.io, they made Tools like cargo-release poll the server. We could easily do similar in cargo until an improved registry protocol is made. I was looking at implementing it but there was a large hurdle for writing the relevant tests. The new sparse registry code has improved the test infrastructure so I could now write the relevant tests. |
Can the unstable feature be enabled via |
Yes, I think it is:
|
Just an update for anyone following this issue. A proposal for how to configure git vs http is available at https://hackmd.io/@rust-cargo-team/B13O52Zko. Additionally #10964 and #10965 contain some more background. |
Hi, has there been any progress on this? Anything I can help with? We would really like to help this get into stable ASAP |
Thank you for being interested in this feature! The Cargo team and contributors are currently working hard on this topic, as well as collaborating with crates.io team to build up the infrastructure needed (rust-lang/crates.io#5200, rust-lang/crates.io#5112, rust-lang/crates.io#5066, etc). One of the things we're happy to collect is feedback for this feature. Personally I'd appreciate any user feedback, especially about user experiences. You can find more relevant issues from label https://github.com/rust-lang/cargo/labels/Z-sparse-registry, or in the description of this issue, which contains the development history and unresolved issues. |
@kornelski We're already using that option in the clients. However, for production use we must not use the upstream repositories but Artifactory remote caches instead. Now the problem is that Artifactory cannot properly update its remote caches from the upstream repo when a new previously uncached package is requested. This is definitely a bug in Artifactory but they refuse to fix it and the only answer we got from them is that we should use sparse registries instead which seems to work. |
I'd also be interested on when this might hit stable. We also have CI difficulties/runarounds in docker because Cargo deciding that it needs to clone the index from scratch takes a long time for whatever reason, and I suspect we're not alone in that. For the curious our docker solution is |
For what it's worth, rust-analyzer also tends to get blamed for this ("but after I closed Code, I ran |
It's bad even on my gigabit internet at this point if I'm being honest. But since that's once per install that doesn't seem worth complaining about, or something like that. I'll be honest though: I dread that progress bar nowadays. |
A proposal to stabilize this has been posted at #11224. |
Stabilize sparse-registry ### What does this PR try to resolve? Stabilize `sparse-registry` * Does not change the default protocol for accessing crates.io ### How should we test and review this PR? Set environment variable `REGISTRIES_CRATES_IO_PROTOCOL=sparse` or set in `config.toml`: ``` [registries.crates-io] protocol = 'sparse' ``` cc #9069
Sparse registries are now stabilized and will be available in Rust 1.68, which will be released on 2023-03-09. I'm going to close this tracking issue as I think it has served its purpose. There is still some future work to be continued, such as better support for third-party registries. Those issues can be tracked in the
A-sparse-registry
|
I'm super glad this got merged, but I am having trouble finding the necessary config steps to enable the new behaviour. |
Agreed, this is a great feature! According to the release notes you're supposed to add the setting to |
This implements the HTTP index [RFC](https://rust-lang.github.io/rfcs/2789-sparse-index.html) for Cargo registries. Currently this is a preview feature and you need to use the nightly of `cargo`: `cargo +nightly -Z sparse-registry update` See rust-lang/cargo#9069 for more information. --------- Co-authored-by: Giteabot <[email protected]>
thanks for this and those links, but for future outsider readers like me, it looks like this became the default in cargo 1.70 which was released on June 2023 (https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html#sparse-by-default-for-cratesio), so a better approach now IMO is just to |
Summary
RFC: #2789Area: http sparse registries
Implementation: #10470
Documentation: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#sparse-registry
Issues: A-sparse-registry
This is a tracking issue for RFC #2789, an experimental extension to serve the index over HTTP instead of via git.
Unresolved issues
sparse+
andregistry+
more consistent. HTTP registry implementation #10470 (comment) (resolved Add new SourceKind::SparseRegistry to differentiate sparse registries #11209)index_version
HTTP registry implementation #10470 (comment)http
. They currently implyregistry+
. But ifsparse+
are more common then it would be good to auto detect. RFC: Serve crates-io registry over HTTP as static files rfcs#2789 (comment)index/
when publishing new crates crates.io#4661Does not support fuzzy queries. Is that a blocker? Only used by error messages.This was a misunderstanding, indexes don't support name-based typo suggestions at all. Sparse supports the same case-folding and-
/_
fuzzy comparison as git indexes. Sparse fundamentally won't be able to support typo suggestions, but since cargo hasn't handled that in the past, this isn't a regression, and more like a "can't do that in the future" thing.Current best way to test
To try it out, add the
-Z sparse-registry
flag onnightly-2022-06-20
or newer buildof Cargo. For example, to update dependencies:
The feature can also be enabled by setting the environment variable
CARGO_UNSTABLE_SPARSE_REGISTRY=true
. Setting this variable will have no effect on stableCargo, making it easy to opt-in for CI jobs.
If you see any issues please report them in new tickets here in the Cargo repo. The output of Cargo
with the environment variable
CARGO_LOG=cargo::sources::registry::http_remote=trace
setwill be helpful in debugging.
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Implementation history
Registry functions return Poll to enable parallel fetching of index data #10064
HTTP registry implementation #10470
Refactor RegistryData::load to handle management of the index cache #10482
Require http-registry URLs to end with a '/' #10698
Make -Z http-registry use index.crates.io when accessing crates-io #10725
Improve testing framework for http registries #10738
Make
is_yanked
returnPoll<>
#10830Fix publishing to crates.io with -Z sparse-registry #10831
Refactor check_yanked to avoid some duplication #10835
Change progress indicator for sparse registries #11068
Add retry support to sparse registries #11069
Fix sparse registry lockfile urls containing 'registry+sparse+' #11177
Add new SourceKind::SparseRegistry to differentiate sparse registries #11209
Add configuration option for controlling crates.io protocol #11215
Upload index metadata to
index/
when publishing new crates crates.io#4661Drop index/ prefix when uploading crate metadata. crates.io#4826
The text was updated successfully, but these errors were encountered: