-
Notifications
You must be signed in to change notification settings - Fork 1k
Conversation
…way requirement; optimize sourceHasLatestVersionList check
definitely faster - but not safe 😢. this was added specifically to address #484. |
this is one of the kinds of things for which we may need to refactor the FSM in order to eke out more performance. |
I'm a little confused. Doesn't |
it may actually be the preceding check that's the problem here: if sg.srcState&sourceHasLatestVersionList != 0 { this may need to check both flags, yes, this isn't generally possible with hg or bzr, as |
So are you suggesting that Even given that, aren't the flags still processed in the wrong order? Edit: Or are you suggesting that it is incorrect by definition for the cache to return a version for which the sources are not locally cached in git yet? |
err...not trying to say anything even close to that :/
no, the idea behind the logic is to only update from the remote if we can't satisfy the call with the information we have on hand.
no, i'm...whew, we're having some kind of colossal miscommunication here. i'm going to try to switch to inline comments, maybe that can at least help target the discussion. |
oh, well, shit, part of the issue is that i was conflating |
internal/gps/source.go
Outdated
pvl, err = sg.src.listVersions(ctx) | ||
return err | ||
}) | ||
if len(sg.cache.getAllVersions()) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this conditional is kinda undermining the purpose of the FSM - it's effectively saying that EITHER the sourceHasLatestVersionList
bit can be set, OR the cache can have a non-empty version set. it was this kind of multiple-sources-of-truth stuff in the old implementation that made me move to this model in the first place.
basically, if there's a case where this conditional isn't hit, it means there's a bug somewhere else, as that place should've also known to go and update sg.srcState
accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This other case doing a check threw me off:
case sourceExistsLocally:
if !sg.src.existsLocally(ctx) {
So I added that check thinking it could be the source of my problems, but never confirmed it. Happy to revert.
OK, i understand again now.
yes, that's what i'm saying that method has ended up being used for. though, now that i'm looking at the context around it, that's making a lot less sense - it seems like 4871d2f is what's actually playing that defense correctly. i'm starting to agree that i can't actually see what purpose is served by fetching there. |
|
@sdboyer Is there anything left to reconsider here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, we're good
What does this do / why do we need it?
Drops
convertToRevision
'ssourceHasLatestLocally
requirement, and optimizes thesourceHasLatestVersionList
requirement check. This should increase cache hits.What should your reviewer look out for in this PR?
Correctness.
Which issue(s) does this PR fix?
Related to #431