sourcegraph/internal/workerutil
Varun Gandhi 93818e0d9b
fix: Try workaround for bad index choice when updating execution logs (#64328)
Under high contention, the updating of execution logs query:

```
UPDATE
  lsif_indexes
SET
  execution_logs = execution_logs || $1::json
WHERE
  id = $2
  AND worker_hostname = $3
  AND state = $4 RETURNING ARRAY_LENGTH(execution_logs, $5)
```

Was taking multiple seconds due to lock contention on the
lsif_indexes_state index.

![image](https://github.com/user-attachments/assets/be58bc97-0995-4909-a032-69084ad995c5)

Running `EXPLAIN ANALYZE` on Sourcegraph.com under lower contention uses
the primary key index on id, so we don't have an easy way to test the
high contention scenario. Try this alternate query form to see if that fixes the issue.
2024-08-07 13:22:15 +02:00
..
dbworker fix: Try workaround for bad index choice when updating execution logs (#64328) 2024-08-07 13:22:15 +02:00
BUILD.bazel lib/background: upgrade Routine interface with context and errors (#62136) 2024-05-24 10:04:55 -04:00
CODENOTIFY codenotify: dr. fritz is kil (#57313) 2023-10-03 16:19:55 +00:00
handler.go worker: make worker constructs (handler, store, resetter etc) type parameterized (#44294) 2022-11-22 14:25:02 +00:00
idset_test.go Worker: use string ID instead of int for job tracking (#52454) 2023-05-26 16:26:42 +02:00
idset.go Worker: use string ID instead of int for job tracking (#52454) 2023-05-26 16:26:42 +02:00
main_test.go Make worker cancellation a worker-native feature (#38752) 2022-07-19 13:46:27 +02:00
mocks_test.go Worker: use string ID instead of int for job tracking (#52454) 2023-05-26 16:26:42 +02:00
observability.go Housekeeping: Rename variables to avoid collisions with packages (#47179) 2023-01-31 16:28:43 +01:00
store.go Worker: use string ID instead of int for job tracking (#52454) 2023-05-26 16:26:42 +02:00
worker_test.go lib/background: upgrade Routine interface with context and errors (#62136) 2024-05-24 10:04:55 -04:00
worker.go lib/background: upgrade Routine interface with context and errors (#62136) 2024-05-24 10:04:55 -04:00