aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres/insert_module.go
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2021-02-02 14:45:34 -0500
committerJonathan Amsterdam <jba@google.com>2021-02-02 20:45:21 +0000
commit20c12b3eefe6a2d29c6d6eabcdc04da1557e8c0f (patch)
tree1c1ec7544069e964a1dcc53b8a864949d4e4f61a /internal/postgres/insert_module.go
parenta4db71b0ea6262929250280863d0f9ea99c41415 (diff)
downloadgo-x-pkgsite-20c12b3eefe6a2d29c6d6eabcdc04da1557e8c0f.tar.xz
internal/postgres: detect missing row in paths table
We occasionally see what we think a failure of insertPaths to insert all the rows missing from the paths table. Add a check to confirm that hypothesis. Change-Id: I15fd8b1d7a1b999a7dfbbe5ca2d93419b90af41d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/288830 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
Diffstat (limited to 'internal/postgres/insert_module.go')
-rw-r--r--internal/postgres/insert_module.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/postgres/insert_module.go b/internal/postgres/insert_module.go
index fad2ae4b..3ee23745 100644
--- a/internal/postgres/insert_module.go
+++ b/internal/postgres/insert_module.go
@@ -314,7 +314,10 @@ func (pdb *DB) insertUnits(ctx context.Context, db *database.DB, m *internal.Mod
}
}
v1path := internal.V1Path(u.Path, m.ModulePath)
- pathID := pathToID[u.Path]
+ pathID, ok := pathToID[u.Path]
+ if !ok {
+ return fmt.Errorf("no entry in paths table for %q; should be impossible", u.Path)
+ }
pathIDToPath[pathID] = u.Path
unitValues = append(unitValues,
pathID,