-
Notifications
You must be signed in to change notification settings - Fork 129
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
Spago database falling out of sync with registry without explicit spago fetch
#1221
Comments
Encountered a second issue related to this. This time, installing the
However, running But then, weirdly:
The This one is a blocking issue; I can't install |
This is another downstream consequence of the whole "lockfiles make spago not hit the network": we used to always pull the registry and refresh the database, but we don't do that as consistently anymore and this creates discrepancies in the DB cache - see #1214 for another example of this. I'll have a look at this, but in the meantime does removing the lockfile help? This should trigger a proper refresh. |
Had a little digging:
Given the last point, the fact that |
Is there a reason not to fully update the database (ie. including metadata) every time we pull the registry? I was puzzled to see the registry metadata in git was up to date, but not up to date in the database. |
I’ll have to verify this when I’m back at that machine; if I remember correctly, no, removing the lock file didn’t make a difference. |
"Fully update the database" in this case would mean reading all the metadata files potentially every 15 minutes (which is our cutoff for "the registry is fresh enough to not pull"). It's not necessary because very few of them have changed at any given moment, so we read them up on demand, which worked when the lockfile was not delaying updates. As a side note, I have never encountered this particular instance of the problem - I would be curious to see if we can repro, e.g. fresh cloning of a repo with a lockfile and no local database |
Interesting — I came back to the machine I was testing this on and attempted an install of
This is odd because I haven't even accessed this machine since I was testing for this issue. Nothing has changed about its state except for more time elapsing, which makes me think there is some interaction with the 15-minute timer too. |
I wonder if this logic is at fault? Lines 195 to 207 in 82d99ab
The important bit is that Not sure how to go at it - maybe we should |
I'm encountering an issue where the Spago database is out of sync with the registry and therefore I'm failing to install packages.
The full sequence of events I went through is below, but I ended up being able to get what I needed by running
spago fetch
. I still think there's at least a UX improvement here, though, around when we choose to fetch.Alright, let's get to the reproduction.
spago
: 0.93.29purs
: 0.15.15package-set
(registry) 50.15.0When installing ordered-collections I got this error:
This is a bit weird, because the version of ordered-collections in package set
50.15.0
is3.2.0
, and that version has a metadata entry in the registry.I saw that
spago install --verbose ordered-collections
fails when accessing ordered-collections in the database:So I did some spelunking there and saw that yes, the database is out of sync with the registry and doesn't include this version of ordered_collections. Specifically, I inspected the sqlite database:
My first thought was the last_git_pull, but that's up to date:
My next thought was to check the
package_metadata
, and indeed ordered-collections@3.2.0 isn't there.However, the package set I want is in the package_sets table, and if I inspect its contents in the package_set_entries table I can see ordered-collections@3.2.0 listed.
So then I went to check what Spago reports about the registry entry for the package:
OK, so maybe the registry index hadn't been fetched even though the last_git_pull in the database was recent; perhaps that was just pulling from the registry, not the registry-index. What happens if we install ordered-collections now?
We make it through ordered-collections, but then we hit another package not updated in the database. This isn't tenable. So what's going on with the git repositories themselves? Let's look at the global cache.
Unexpectedly, both the registry and registry-index are up to date:
The version of profunctor in 50.15.0 is 6.0.1, so let's see if it's in here:
Yeah, it is. But if we go back to sqlite:
It ain't in there. Something is out of sync between the database and the git repositories. Then I searched a little bit for a way to get Spago to refresh everything and remembered
spago fetch
. Running that:Ah! OK, now everything is up to date. But surely
fetch
should have been run earlier in this process, like during theinstall
command?The text was updated successfully, but these errors were encountered: