Skip to content

repo-updater: fool-proof listing of IDs of inserted repos

Warren Gifford requested to merge core/repo-soft-undelete into master

Created by: keegancsmith

Rather than using fancy SQL, we update our code to issue a SELECT after we have gone through updating and inserting into the repo table. This is pretty fool-proof and much easier to understand.

We also remove the coupling between i and ordinality in the scanAll closure. Instead we can return the ordinality so we always update the correct position.

This does send along the full repo struct for listing, when all we actually need is the external repo spec. This could be optimized in the future if it shows up as a hotspot, but for simplicity we reuse the existing batch functionality.

Also included in this commit is a minor optimization around skipping ops with no repos to change. Additionally we fix a test case which created bad data (missing external repo id). We also assert we set ID in DBStore.UpsertRepos.

Fixes https://github.com/sourcegraph/sourcegraph/issues/7750

Merge request reports

Loading