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

Fetch doesn't work for recently updated package #528

Merged
merged 1 commit into from Jan 29, 2016

Conversation

MartinNowak
Copy link
Member

I have updated a package of mine on the registry around 30 minutes ago. When I try using it as a dependency, I get:
Root package psql-native contains reference to invalid package backtrace-d

If I try to dub fetch backtrace-d --version=0.1.0, I get:
No package backtrace-d was found matching the dependency 0.1.0

If I try the ~master version, it works.
If I try a different package, it works.

If I am doing a mistake, a better error message would be nice. Otherwise, there is a bug somewhere.

@yazd
Copy link
Author

yazd commented Mar 17, 2015

I had to dub clean-caches and then everything worked nicely.
Did I have to do that or were the caches corrupted/invalid for some reason?

@s-ludwig
Copy link
Member

Hm, looks like the caches should be circumvented when an explicit request for an uncached Version happens. Currently, AFAIR, the local cache is always used and if it is out of date, this error will happen.

@MartinNowak
Copy link
Member

Hm, looks like the caches should be circumvented when an explicit request for an uncached Version happens.

Yes, you're right. I might fix it later today.

@rcorre
Copy link

rcorre commented Apr 20, 2015

Just ran into this with a package that was updated 16hrs ago -- dub clean-caches fixed it for me.

Hm, looks like the caches should be circumvented when an explicit request for an uncached Version happens

What is an explicit request in this case? Would this fix only apply to dub fetch? Or should a dub build automatically check if there is a newer version matching my version spec without my having to clean the cache?

@MartinNowak
Copy link
Member

Or should a dub build automatically check if there is a newer version matching my version spec without my having to clean the cache?

That greatly limits the usefulness of the cache to an etag comparison.

What is an explicit request in this case?

I'd say dub fetch foo --version=0.1.0 and maybe also dub upgrade, in general any request for a specific package version.

@s-ludwig
Copy link
Member

I'd say dub fetch foo --version=0.1.0 and maybe also dub upgrade.

Yeah, let's do both. I guess that there will be a lot less confusion that way and speed is only really important for the build process anyway.

Revert "store metadata cache on disk"

This reverts commit 161aad0.

We only ask the package suppliers for metadata when upgrading or
searching a specific package version. In particular building an already
fetched package does not ask the package suppliers (only the package
manager responsible for locally installed packages).

In all cases where we get data from a package supplier we want to get
the latest available information. Therefor it doesn't make sense to
cache any metadata from the package suppliers on disk.

Not sure whether we still need the in memory metadata cache (e.g. for
multiple queries during dependency resolution).
@MartinNowak
Copy link
Member

We only ask the package suppliers for metadata when upgrading or
searching a specific package version. In particular building an already
fetched package does not ask the package suppliers (only the package
manager responsible for locally installed packages).

In all cases where we get data from a package supplier we want to get
the latest available information. Therefor it doesn't make sense to
cache any metadata from the package suppliers on disk.

Not sure whether we still need the in memory metadata cache (e.g. for
multiple queries during dependency resolution).

The other need to query package suppliers (regular upgrade check) is already covered by the project local upgrade cache in ./dub/dub.json.

@s-ludwig
Copy link
Member

Sounds reasonable. Wonder how the current situation came to be.

s-ludwig added a commit that referenced this pull request Jan 29, 2016
Fetch doesn't work for recently updated package
@s-ludwig s-ludwig merged commit 1f1548b into dlang:master Jan 29, 2016
@MartinNowak MartinNowak deleted the fix528 branch January 29, 2016 14:54
@MartinNowak
Copy link
Member

Sounds reasonable. Wonder how the current situation came to be.

I added it to not hit the website on a rebuild. Not sure why it did back then, maybe the upgrade cache wasn't yet working?
Pretty sure I tested it like described here.
When I added the cache I didn't know much about the distinction between PackageManager and PackageSupplier and why the metadata was actually queried.

@s-ludwig
Copy link
Member

Yeah, I was mostly wondering, because there were hard numbers in #388. Anyway, not really important now either - I didn't notice any degrade in performance.

@MartinNowak
Copy link
Member

s-ludwig commented 3 days ago
Yeah, I was mostly wondering, because there were hard numbers in #388. Anyway, not really important now either - I didn't notice any degrade in performance.

Maybe sth. w/ dub.selections.json or the upgrade cache wasn't working back then?
I remember that the metadata cache got rid of a 150ms round trip for every build.
I did test this PR with disabled network, just to be sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants