You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
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:
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
The text was updated successfully, but these errors were encountered: