diff options
| author | Rob Findley <rfindley@google.com> | 2025-11-07 15:10:13 +0000 |
|---|---|---|
| committer | Robert Findley <rfindley@google.com> | 2025-11-10 07:02:43 -0800 |
| commit | c348742172c9007d0db71b56e84a6091ecf59059 (patch) | |
| tree | 5cc46af3863f63ba23ff8619c07799c2c04ddb0c | |
| parent | 0d7e29046a911358f7f5a5c4028a9db875187281 (diff) | |
| download | go-x-pkgsite-c348742172c9007d0db71b56e84a6091ecf59059.tar.xz | |
internal/postgres: remove the exclusive lock in upsertPath
As described in golang/go#75959, the lock in upsertPath causes a
significant amount of contention during module inserts. Meanwhile, the
upsertPaths method does not acquire a lock, and does not seem to cause
deadlocks.
We still don't understand the deadlocks avoided by this lock, but it
seems that a low level of failed transactions due to deadlock may be
preferable to the contention we're seeing currently. Let's experiment
with removing the lock.
For golang/go#75959
Change-Id: I2d577b426724010e96ffc8129ae469825fdcb938
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/718720
kokoro-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ethan Lee <ethanalee@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
| -rw-r--r-- | internal/postgres/path.go | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/internal/postgres/path.go b/internal/postgres/path.go index 9b2edf3b..972182ac 100644 --- a/internal/postgres/path.go +++ b/internal/postgres/path.go @@ -84,9 +84,6 @@ func upsertPath(ctx context.Context, tx *database.DB, path string) (id int, err // fine. defer derrors.WrapStack(&err, "upsertPath(%q)", path) - if _, err := tx.Exec(ctx, `LOCK TABLE paths IN EXCLUSIVE MODE`); err != nil { - return 0, err - } err = tx.QueryRow(ctx, `INSERT INTO paths (path) VALUES ($1) ON CONFLICT DO NOTHING RETURNING id`, path).Scan(&id) |
