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

Registry functions return Poll to enable parallel fetching of index data #10064

Merged
merged 4 commits into from
Mar 9, 2022

Conversation

arlosi
Copy link
Contributor

@arlosi arlosi commented Nov 9, 2021

Adds Poll as a return type for several registry functions to enable parallel fetching of crate metadata with a future http-based registry.

Work is scheduled by calling the query and related functions, then waited on with block_until_ready.

This PR is based on the draft PR started by eh2406 here #8985.

r? @Eh2406
cc @alexcrichton
cc @jonhoo

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 9, 2021
@arlosi
Copy link
Contributor Author

arlosi commented Nov 9, 2021

I've updated the @jonhoo 's http registry prototype based on this change and the initial results look good. Not quite ready for PR yet though: arlosi@dd5eb9e#diff-cb43b9ba868eedb392ea22664d59b4444dd7c4c4f5e641ab045aa861a38ffa4c

@Eh2406
Copy link
Contributor

Eh2406 commented Nov 11, 2021

Thank you for picking this up!

/// Block until all outstanding Poll::Pending requests are Poll::Ready.

I assumed we would have an API more like "Block until at least one outstanding request is Poll::Ready". But having thought about it the conditions for my API to be helpful are corner cases of corner cases. And if you're only making one request your API prevents needing a retry loop, query is guaranteed to return Ready after only one call to block_until_ready.

@alexcrichton
Copy link
Member

Thanks for picking this up @arlosi! Are you interested in pushing this through to completion? I've got some thoughts about how best to go about that, but if you mostly just wanted to rebase it may not be too interesting to discuss my thoughts at this time.

@arlosi
Copy link
Contributor Author

arlosi commented Nov 16, 2021

@alexcrichton yes, I'd like to get this completed! Any suggestions you have to move it forward would be awesome.

@alexcrichton
Copy link
Member

Ok so talking with @Eh2406 a bit yesterday one of the concerns is that while this infrastructure makes sense none of it's really being exercised yet (since everything is always "ready"). I think that we will actually want to change how remote sources (git/registry) work today to actually leverage this new functionality, however. Basically I think that the query method should never block, including the git/registry sources that we have today. Instead they would be updated to follow this methodology where query queries the internal caches and if something isn't found then it's "not ready" and records internally what needs to happen. Later on the "wait for everything" it'd actually do blocking work and network things like happens today. Does that make sense?

@arlosi
Copy link
Contributor Author

arlosi commented Jan 6, 2022

I'm finally coming back to this in the new year. @alexcrichton I'm hoping for some clarification on what you'd like here for the existing git model. Currently, the query method doesn't block in the git model. If work needs to be done (such as fetching the repo), then the query method will fail, and the caller would do an update() then re-try the query. See here for details:

fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary)) -> CargoResult<()> {

All the blocking work currently happens in the Source::update method for git-based registries, and I'm not sure what we'd like to do with it. It could be changed to return Poll, then actually updating (git fetching) would be done in the block_until_ready. This would necessitate many changes in the callers -- and I'm not sure it really makes sense, since we'd just be adding loops calling block_until_ready. Or we could re-design the callers of update as well, so that the meaning of Source::update is "ensure you have the latest data when running query". That would mean that no updating actually occurred until a query was started, and block_until_ready was called.

This change has the potential to become large, depending on how much of the design is changed and I want to make sure we get agreement on how we want it to look before doing the work.

@alexcrichton
Copy link
Member

Yes that's a good point, and also an indicator at how the current design is a bit sprawling... Currently there's basically an implicit "protocol" between the resovler and sources that the resolve will appropriately, for some definition of "appropriately" call update ahead of time before calling query if necessary. This means that for git sources the resolver determines that update needs to be called and invokes it.

Instead I think a better model would be to remove update entirely, folding the functionality into a query and block_until_ready split. This is indeed a large-ish change, and won't be trivial to make. I think, though, that this new model can be implemented today without changing the underlying implementations, just the interface to them largely.

If the same loop ends up being written in Cargo then that seems emminently solvable with a helper method or similar, I don't think we need to worry too much about the impact. The purpose of this change is to enable parallel downloads and updates for the resolver, and if everything else doesn't act in parallel that's ok we can update them later over time.

@bors
Copy link
Contributor

bors commented Jan 12, 2022

☔ The latest upstream changes (presumably #10269) made this pull request unmergeable. Please resolve the merge conflicts.

updating, registries now update as needed. To force a registry to
ensure the latest copy of crate metadata is available, a new method
called `invalidate_cache` is added. This method will cause the registry
to update the next time `block_until_ready` is called.
@arlosi
Copy link
Contributor Author

arlosi commented Feb 28, 2022

@alexcrichton I updated this PR to remove the update method as you suggested.

If the registry has no local cache (hasn't been cloned yet, for instance), then queries will return Poll::Pending, and block_until_ready will do the cloning.

I also added an "invalidate_cache" method on the registry that makes subsequent queries return Poll::Pending even if a local clone exists. Calling block_until_ready then does the update and subsequent calls to query will return results.

Copy link
Contributor

@Eh2406 Eh2406 left a comment

Choose a reason for hiding this comment

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

Overall I think this is looking really good! Thank you for pushing this along.

}
});
for (_, source) in sources.iter_mut() {
source.block_until_ready().ok()?;
Copy link
Contributor

Choose a reason for hiding this comment

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

So I think one of the fundamental questions is can block_until_ready spuriously wake?
I.E. If block_until_ready returns, can the next call to query return Poll::Pending?

If Yes, then this loop is correct. But we should document it.

If No, then this loop seems like overkill. As it has to pass on the second iteration. (The same pattern is also true in other loops but I'm only gonna comment here.)

Another fundamental question is what happens if you call block_until_ready on a source that has not yet returned Poll::Pending?

To be specific, do we iterate over sources.iter_mut() or only the ones that are still in package_ids?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For a given source and query parameters, a query call that previously returned Poll::Pending must return Poll::Ready after calling block_until_ready. If the query parameters are different (such as querying for a package that hasn't been queried before), then query may return Poll::Pending, even after a block_until_ready call.

Calling block_until_ready if a source hasn't yet returned a Poll::Pending is an interesting question. If you call invalidate_cache + block_until_ready, the git-based sources will do a fetch.

I agree we should be more precise here and only call block_until_ready for the sources remaining in package_ids

Copy link
Contributor

Choose a reason for hiding this comment

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

For a given source and query parameters, a query call that previously returned Poll::Pending must return Poll::Ready after calling block_until_ready. If the query parameters are different (such as querying for a package that hasn't been queried before), then query may return Poll::Pending, even after a block_until_ready call.

If we trust that must then we don't need a loop. So instead of "loops" like:

let config = loop {
    match self.config()? {
        Poll::Ready(cfg) => break cfg.unwrap(),
        Poll::Pending => self.block_until_ready()?,
    }
};

We can have:

let config = match self.config()? {
    Poll::Ready(cfg) => cfg.unwrap(),
    Poll::Pending => {
         self.block_until_ready()?;
         self.config()?.expect("must get Pending after block_until_ready").unwrap()
    }
};

of course will probably want some kind of helper to DRY the redundant self.config()?. And possibly a helper to deal with (the two) places where we have a vec of things to query.

Overnight the possibility of weakening it to should started to grow on me. So someone implementing the trait should make sure that the second query always returns a Ready. But, someone using the trait has to loop calling block_until_ready until the query returns Ready.

Whatever we decide we should document it on the trait.

Calling block_until_ready if a source hasn't yet returned a Poll::Pending is an interesting question. If you call invalidate_cache + block_until_ready, the git-based sources will do a fetch.

I think we should define block_until_ready before Poll::Pending/invalidate_cache as a NOP. For example this loop calls block_until_ready on all sources even if only some of them need it:

for (source_id, source) in self.sources.sources_mut() {
source
.block_until_ready()
.with_context(|| format!("Unable to update {}", source_id))?;
}

Keeping track of witch ones need it, seams like a lot of extra work.
Can we document on the trait when it is an NOP, and point out that it is a recommended optimization to avoid unneeded calls to block_until_ready?

Copy link
Contributor Author

@arlosi arlosi Mar 7, 2022

Choose a reason for hiding this comment

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

Ok, I've changed it to should return Poll::Ready after block_until_ready and updated the doc comments. Let me know if it makes more sense now!

)
})?;

let summaries = match source.query_vec(dep)? {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is nightly only as try_trait_v2, so we can't use it, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

On stable you can not imple the trait in try_trait_v2. You can use ?, even though it de-sugars to them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, so I am already using the try_trait_v2 here already. That's what's enabling ? to cause Poll::Ready(Err(...)) to return up.

Maybe I'm missing something, but I don't see any way to use it further here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, sorry for the miss communication. Given how ? works on Poll your code is correct. I was leaving a note that ? did not do what I expected.

Poll::Pending => match registry.block_until_ready() {
Ok(()) => continue,
Err(e) => return to_resolve_err(e),
},
Copy link
Contributor

Choose a reason for hiding this comment

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

@alexcrichton you asked for this loop to be removed in #8985 (comment) on the previous PR, what do you think now?

@@ -17,6 +18,7 @@ pub struct DirectorySource<'cfg> {
root: PathBuf,
packages: HashMap<PackageId, (Package, Checksum)>,
config: &'cfg Config,
updated: bool,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be clearer to use packages.is_empty() as the unupdated state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that could cause an infinite updating loop if the directory source had no packages in it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good call.

src/cargo/sources/git/source.rs Outdated Show resolved Hide resolved
src/cargo/sources/git/source.rs Outdated Show resolved Hide resolved
src/cargo/sources/registry/remote.rs Outdated Show resolved Hide resolved
src/cargo/sources/registry/remote.rs Outdated Show resolved Hide resolved
@alexcrichton
Copy link
Member

I'm going to be stepping down from the Cargo team so feel free to merge this without me, I unfortunately won't be able to get around to reviewing this.

@Eh2406
Copy link
Contributor

Eh2406 commented Mar 9, 2022

Without alex watching over us we will have to make our mistakes the hard way.

@bors r+

@bors
Copy link
Contributor

bors commented Mar 9, 2022

📌 Commit 0c07056 has been approved by Eh2406

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 9, 2022
@bors
Copy link
Contributor

bors commented Mar 9, 2022

⌛ Testing commit 0c07056 with merge a77ed9b...

@bors
Copy link
Contributor

bors commented Mar 9, 2022

☀️ Test successful - checks-actions
Approved by: Eh2406
Pushing a77ed9b to master...

@arlosi arlosi mentioned this pull request Mar 9, 2022
5 tasks
@ehuss
Copy link
Contributor

ehuss commented Mar 16, 2022

This PR is causing errors when integrating upstream. Can you take a look at it? You can test in the rust-lang/rust repo by doing:

  1. git submodule update --init
  2. git submodule update --remote src/tools/cargo
  3. cargo update -p cargo
  4. Set submodules=false in config.toml
  5. ./x.py test src/tools/cargo

I am seeing the following errors:

failures:

---- install::install_semver_metadata stdout ----
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo --registry alternative --v
ersion 1.0.0+abc`
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo --registry alternative`
thread 'install::install_semver_metadata' panicked at '
test failed running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo --registry alt
ernative`
error: stderr did not match:
1        -    Updating `alternative` index
2   1          Ignored package `foo v1.0.0+abc (registry `alternative`)` is already installed, use --force to override
3   2     warning: be sure to add [..]


other output:

', src/tools/cargo/tests/testsuite/install.rs:1947:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- install_upgrade::already_installed_updates_yank_status_on_upgrade stdout ----
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo --version=1.0.0`
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo --version=1.0.1`
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo --version=1.0.1`
thread 'install_upgrade::already_installed_updates_yank_status_on_upgrade' panicked at '
test failed running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo --version=1.0.
1`
error: process exited with code 101 (expected 0)
--- stdout

--- stderr
error: cannot install package `foo`, it has been yanked from registry `crates-io`
', src/tools/cargo/tests/testsuite/install_upgrade.rs:830:10

---- install_upgrade::already_installed_exact_does_not_update stdout ----
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo --version=1.0.0`
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo --version=1.0.0`
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo '--version=>=1.0.0'`
thread 'install_upgrade::already_installed_exact_does_not_update' panicked at '
test failed running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo '--version=>=1
.0.0'`
error: stderr did not match:
1        -    Updating `[..]` index
2   1          Ignored package `foo v1.0.0` is already installed[..]
3   2     warning: be sure to add [..]


other output:

', src/tools/cargo/tests/testsuite/install_upgrade.rs:779:10

---- install_upgrade::no_track stdout ----
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install --no-track foo`
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install --no-track foo`
thread 'install_upgrade::no_track' panicked at '
test failed running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install --no-track foo`
error: stderr did not match:
1        -    Updating `[..]` index
2   1     error: binary `foo` already exists in destination `[..]/.cargo/bin/foo`
3   2     Add --force to overwrite


other output:

', src/tools/cargo/tests/testsuite/install_upgrade.rs:703:10

---- install_upgrade::registry_upgrade stdout ----
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo`
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/tmp/cit/t1302/home/.cargo/bin/foo-1`
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo`
thread 'install_upgrade::registry_upgrade' panicked at '
test failed running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo`
error: stderr did not match:
1        -    Updating `[..]` index
2   1          Ignored package `foo v1.0.0` is already installed[..]
3   2     warning: be sure to add [..]


other output:

', src/tools/cargo/tests/testsuite/install_upgrade.rs:155:10

---- install_upgrade::v1_already_installed_dirty stdout ----
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo`
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo`
thread 'install_upgrade::v1_already_installed_dirty' panicked at '
test failed running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo`
error: expected to find:
   Compiling foo v1.0.1

did not find in output:
     Ignored package `foo v1.0.0` is already installed, use --force to override
warning: be sure to add `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/tmp/cit/t1308/home/.cargo/bin` to yo
ur PATH to be able to run the installed binaries
', src/tools/cargo/tests/testsuite/install_upgrade.rs:330:10

---- install_upgrade::upgrade_force stdout ----
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo`
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo --force`
thread 'install_upgrade::upgrade_force' panicked at '
test failed running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install foo --force`
error: stderr did not match:
1        -    Updating `[..]` index
2   1       Installing foo v1.0.0
    2    +    Updating `dummy-registry` index
3   3        Compiling foo v1.0.0
4   4         Finished release [optimized] target(s) in [..]
5   5        Replacing [..]/.cargo/bin/foo
6   6         Replaced package `foo v1.0.0` with `foo v1.0.0` (executable `foo`)
7   7     warning: be sure to add `[..]/.cargo/bin` to your PATH [..]


other output:

', src/tools/cargo/tests/testsuite/install_upgrade.rs:223:10

---- install_upgrade::multiple_report stdout ----
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install one two three`
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install one two three`
thread 'install_upgrade::multiple_report' panicked at '
test failed running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install one two three`
error: stderr did not match:
1        -    Updating `[..]` index
2   1          Ignored package `one v1.0.0` is already installed, use --force to override
3   2          Ignored package `two v1.0.0` is already installed, use --force to override
4        - Downloading crates ...
5        -  Downloaded three v1.0.1 (registry `[..]`)
6        -  Installing three v1.0.1
7        -   Compiling three v1.0.1
8        -    Finished release [optimized] target(s) in [..]
9        -   Replacing [..]/.cargo/bin/three
10       -   Replacing [..]/.cargo/bin/x
11       -   Replacing [..]/.cargo/bin/y
12       -    Replaced package `three v1.0.0` with `three v1.0.1` (executables `three`, `x`, `y`)
    3    +     Ignored package `three v1.0.0` is already installed, use --force to override
13  4          Summary Successfully installed one, two, three!
14  5     warning: be sure to add `[..]/.cargo/bin` to your PATH [..]


other output:

', src/tools/cargo/tests/testsuite/install_upgrade.rs:647:10

---- publish_lockfile::warn_package_with_yanked stdout ----
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo generate-lockfile`
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo package --no-verify`
thread 'publish_lockfile::warn_package_with_yanked' panicked at '
test failed running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo package --no-verify`
error: stderr did not match:
1   1        Packaging foo v0.0.1 ([..])
2        -    Updating `[..]` index
3        -warning: package `bar v0.1.0` in Cargo.lock is yanked in registry `crates-io`, consider updating to a version that is not yanked


other output:

', src/tools/cargo/tests/testsuite/publish_lockfile.rs:339:10

---- publish_lockfile::warn_install_with_yanked stdout ----
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install --locked foo`
running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install --force foo`
thread 'publish_lockfile::warn_install_with_yanked' panicked at '
test failed running `/home/eric/Proj/rust/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/cargo install --force foo`
error: stderr did not match:
1        -    Updating `[..]` index
2   1       Installing foo v0.1.0
    2    +    Updating `dummy-registry` index
3   3      Downloading crates ...
4   4       Downloaded bar v0.1.1 (registry `[..]`)
5   5        Compiling bar v0.1.1
6   6        Compiling foo v0.1.0
7   7         Finished release [optimized] target(s) in [..]
8   8        Replacing [..]/.cargo/bin/foo
9   9         Replaced package `foo v0.1.0` with `foo v0.1.0` (executable `foo`)
10  10    warning: be sure to add [..]


other output:

', src/tools/cargo/tests/testsuite/publish_lockfile.rs:404:10


failures:
    install::install_semver_metadata
    install_upgrade::already_installed_exact_does_not_update
    install_upgrade::already_installed_updates_yank_status_on_upgrade
    install_upgrade::multiple_report
    install_upgrade::no_track
    install_upgrade::registry_upgrade
    install_upgrade::upgrade_force
    install_upgrade::v1_already_installed_dirty
    publish_lockfile::warn_install_with_yanked
    publish_lockfile::warn_package_with_yanked

@ehuss
Copy link
Contributor

ehuss commented Mar 16, 2022

These errors are from running cargo test --release, it is not necessary to use the rust repo.

@arlosi
Copy link
Contributor Author

arlosi commented Mar 16, 2022

@ehuss looking into it now.

@arlosi
Copy link
Contributor Author

arlosi commented Mar 16, 2022

@ehuss Fix is available in #10482. I tested it locally in both debug and release.

arlosi added a commit to arlosi/cargo that referenced this pull request Mar 17, 2022
…tself.

This enables registry implementations to signal if the cache is valid
on a per-request basis.

Fixes a bug introduced by rust-lang#10064 that caused Cargo not to update for
several cases in a release build because it believed the index cache to
be valid when it was not.
bors added a commit that referenced this pull request Mar 17, 2022
Refactor RegistryData::load to handle management of the index cache

Enables registry implementations to signal if the cache is valid on a per-request basis.

Fixes a bug introduced by #10064 that caused Cargo not to update for several cases in a release build because it believed the index cache to be valid when it was not. The issue only occurred in release builds because debug builds verify that the cache contents is correct (by refreshing it).

Previously `current_version` was called by the index to determine whether the cache was valid. In the new model, `RegistryData::load` is passed the current version of the cache and returns an enum to indicate the status of the cached data.

r? `@eh2406`
cc `@ehuss`
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 19, 2022
Update cargo

9 commits in 65c82664263feddc5fe2d424be0993c28d46377a..109bfbd055325ef87a6e7f63d67da7e838f8300b
2022-03-09 02:32:56 +0000 to 2022-03-17 21:43:09 +0000
- Refactor RegistryData::load to handle management of the index cache (rust-lang/cargo#10482)
- Separate VCS command paths with "--" (rust-lang/cargo#10483)
- Fix panic when artifact target is used for `[target.'cfg(&lt;target&gt;)'.dependencies` (rust-lang/cargo#10433)
- Bump git2@0.14.2 and libgit2-sys@0.13.2 (rust-lang/cargo#10479)
- vendor: Don't allow multiple values for --sync (rust-lang/cargo#10448)
- Use types to make clere (credential process || token) (rust-lang/cargo#10471)
- Warning on conflicting keys (rust-lang/cargo#10316)
- Registry functions return Poll to enable parallel fetching of index data (rust-lang/cargo#10064)
- Refine the contributor guide (rust-lang/cargo#10468)
@ehuss ehuss added this to the 1.61.0 milestone Apr 7, 2022
bors added a commit to rust-lang/rust-semverver that referenced this pull request May 23, 2022
Upgrade Cargo to 0.62.0

Address the changes on rust-lang/cargo#10064
Hezuikn pushed a commit to Hezuikn/cargo that referenced this pull request Sep 22, 2022
…tself.

This enables registry implementations to signal if the cache is valid
on a per-request basis.

Fixes a bug introduced by rust-lang#10064 that caused Cargo not to update for
several cases in a release build because it believed the index cache to
be valid when it was not.
Hezuikn pushed a commit to Hezuikn/cargo that referenced this pull request Sep 22, 2022
…tself.

This enables registry implementations to signal if the cache is valid
on a per-request basis.

Fixes a bug introduced by rust-lang#10064 that caused Cargo not to update for
several cases in a release build because it believed the index cache to
be valid when it was not.
jacobgreenleaf pushed a commit to flash-research/debcargo-vendor that referenced this pull request Aug 20, 2023
the main change seems to be that registries no longer have an explicit
update() call, but instead return `Poll` on queries with a helper to
block until the Poll is ready.

upstream change for reference:
rust-lang/cargo#10064

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants