Fix VLE queries failing on read-only replicas (#2160)#2345
Merged
jrgemignani merged 1 commit intoapache:masterfrom Feb 27, 2026
Merged
Fix VLE queries failing on read-only replicas (#2160)#2345jrgemignani merged 1 commit intoapache:masterfrom
jrgemignani merged 1 commit intoapache:masterfrom
Conversation
jrgemignani
approved these changes
Feb 26, 2026
Contributor
|
@gregfelice Again, ty! Three things -
|
Contributor
Author
|
apologies - fixing
…On Thu, Feb 26, 2026 at 6:47 PM John Gemignani ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Wrong branch
—
Reply to this email directly, view it on GitHub
<#2345 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABBXGAW7EOFMQFVV6XDFRT4N6AZRAVCNFSM6AAAAACWADWNHOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTQNRUGE2TQMZYGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Greg Felice
415.343.5227
***@***.***
linkedin.com/in/gregfelice
calendly.com/gregfelice/30min
|
The global graph cache used by VLE acquired ShareLock when scanning vertex and edge label tables to populate in-memory hashtables. On read-only replicas (standby servers in recovery), PostgreSQL only allows RowExclusiveLock or less, so VLE queries would fail with: "cannot acquire lock mode ShareLock on database objects while recovery is in progress" Change all three functions in age_global_graph.c to use AccessShareLock instead, which is sufficient for read-only table scans and is consistent with the existing ag_cache.c code that performs identical operations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5184acb to
55fd557
Compare
Contributor
Author
|
@jrgemignani Thanks for the review! Rebased onto master (on top of the merged VLE PR) and retarget the PR base branch. AI (Claude, Anthropic) was used to assist in developing this fix. |
Contributor
|
Looks like I have to close and reopen the PR to get the CI to run. Don't panic! |
jrgemignani
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2160.
VLE queries fail on read-only replicas (standby servers) with:
Root Cause
The VLE global graph cache (
age_global_graph.c) acquiresShareLockwhen scanning vertex and edge label tables to populate in-memory hashtables. On standby servers in recovery mode, PostgreSQL restricts locks toRowExclusiveLockor lower.ShareLockexceeds this threshold.The three affected functions are:
get_ag_labels_names()— scansag_labelcatalog tableload_vertex_hashtable()— scans vertex label tablesload_edge_hashtable()— scans edge label tablesAll three perform read-only sequential scans to populate caches — no writes.
Fix
Change
ShareLocktoAccessShareLockin all three functions (6 call sites: 3table_open+ 3table_close).AccessShareLockis:ag_cache.ccode, which performs identical catalog scan operations usingAccessShareLock(18 call sites)Test Plan