Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

fix: Try workaround for bad index choice when updating execution logs#64328

Merged
varungandhi-src merged 1 commit into
mainfrom
vg/try-cte
Aug 7, 2024
Merged

fix: Try workaround for bad index choice when updating execution logs#64328
varungandhi-src merged 1 commit into
mainfrom
vg/try-cte

Conversation

@varungandhi-src

Copy link
Copy Markdown
Contributor

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

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.

Test plan

Existing tests continue to pass.

Slowly increase executor count back to 160 and see if lock contention comes up again.

@cla-bot cla-bot Bot added the cla-signed label Aug 7, 2024
@github-actions github-actions Bot added team/graph Graph Team (previously Code Intel/Language Tools/Language Platform) team/product-platform labels Aug 7, 2024
@varungandhi-src varungandhi-src enabled auto-merge (squash) August 7, 2024 10:59

@eseliger eseliger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fingers crossed

@varungandhi-src varungandhi-src merged commit 93818e0 into main Aug 7, 2024
@varungandhi-src varungandhi-src deleted the vg/try-cte branch August 7, 2024 11:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed team/graph Graph Team (previously Code Intel/Language Tools/Language Platform) team/product-platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants