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

x/pkgsite: split postgres.UpsertVersionState into InsertModuleVersionState and UpdateModuleVersionState #39628

Closed
julieqiu opened this issue Jun 17, 2020 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. pkgsite
Milestone

Comments

@julieqiu
Copy link
Member

julieqiu commented Jun 17, 2020

At the moment, postgres.UpsertModuleVersionState is overloaded: it is used both to insert new versions from the index, and update versions after a fetch. Refactor the following:

  • Split UpsertModuleVersionState into InsertModuleVersionState and UpdateModuleVersionState. Notably:
    • InsertModuleVersionState does not accept a code or fetch error.
    • UpdateModuleVersionState does not accept an index timestamp.
  • On fetch, call UpdateModuleVersionState and simply log NotFound errors, which would occur if the version did not come from the index

This would result in some duplicate processing, because if we fetch a version that is not in the index through the proxy, it will subsequently be added to the index. However, this would be easier to reason about: the module_version_state table should have a 1:1 correspondence with index.golang.org, and timestamps should all be correct.

Related: #39621

@gopherbot gopherbot added this to the Unreleased milestone Jun 17, 2020
@julieqiu julieqiu added pkgsite NeedsFix The path to resolution is known, but the work has not been done. help wanted labels Jun 17, 2020
@AndersonQ
Copy link
Contributor

On it :)

@julieqiu julieqiu changed the title x/pkgsite: split postgres.UpsertModuleVersionState into InsertModuleVersionState and UpdateModuleVersionState x/pkgsite: split postgres.UpsertVersionState into InsertModuleVersionState and UpdateModuleVersionState Aug 21, 2020
@julieqiu julieqiu removed the website label Sep 22, 2020
@julieqiu julieqiu removed the website label Sep 22, 2020
@julieqiu julieqiu self-assigned this Sep 13, 2021
@gopherbot
Copy link

Change https://golang.org/cl/341860 mentions this issue: internal/postgres: change UpsertModuleVersionStates to update

@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. pkgsite
Projects
None yet
Development

No branches or pull requests

3 participants