This is an automated email from the ASF dual-hosted git repository.

jgemignani pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/age.git


The following commit(s) were added to refs/heads/master by this push:
     new 346f3194 Fix VLE queries failing on read-only replicas (#2160) (#2345)
346f3194 is described below

commit 346f319459e18db89deae30a3af7ea945bba101d
Author: Greg Felice <[email protected]>
AuthorDate: Thu Feb 26 19:24:58 2026 -0500

    Fix VLE queries failing on read-only replicas (#2160) (#2345)
    
    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 <[email protected]>
---
 src/backend/utils/adt/age_global_graph.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/backend/utils/adt/age_global_graph.c 
b/src/backend/utils/adt/age_global_graph.c
index c34e51ee..4e5b5863 100644
--- a/src/backend/utils/adt/age_global_graph.c
+++ b/src/backend/utils/adt/age_global_graph.c
@@ -215,7 +215,7 @@ static List *get_ag_labels_names(Snapshot snapshot, Oid 
graph_oid,
                 F_CHAREQ, CharGetDatum(label_type));
 
     /* setup the table to be scanned, ag_label in this case */
-    ag_label = table_open(ag_label_relation_id(), ShareLock);
+    ag_label = table_open(ag_label_relation_id(), AccessShareLock);
     scan_desc = table_beginscan(ag_label, snapshot, 2, scan_keys);
 
     /* get the tupdesc - we don't need to release this one */
@@ -241,7 +241,7 @@ static List *get_ag_labels_names(Snapshot snapshot, Oid 
graph_oid,
 
     /* close up scan */
     table_endscan(scan_desc);
-    table_close(ag_label, ShareLock);
+    table_close(ag_label, AccessShareLock);
 
     return labels;
 }
@@ -493,7 +493,7 @@ static void load_vertex_hashtable(GRAPH_global_context 
*ggctx)
         vertex_label_table_oid = get_relname_relid(vertex_label_name,
                                                    graph_namespace_oid);
         /* open the relation (table) and begin the scan */
-        graph_vertex_label = table_open(vertex_label_table_oid, ShareLock);
+        graph_vertex_label = table_open(vertex_label_table_oid, 
AccessShareLock);
         scan_desc = table_beginscan(graph_vertex_label, snapshot, 0, NULL);
         /* get the tupdesc - we don't need to release this one */
         tupdesc = RelationGetDescr(graph_vertex_label);
@@ -544,7 +544,7 @@ static void load_vertex_hashtable(GRAPH_global_context 
*ggctx)
 
         /* end the scan and close the relation */
         table_endscan(scan_desc);
-        table_close(graph_vertex_label, ShareLock);
+        table_close(graph_vertex_label, AccessShareLock);
     }
 }
 
@@ -601,7 +601,7 @@ static void load_edge_hashtable(GRAPH_global_context *ggctx)
         edge_label_table_oid = get_relname_relid(edge_label_name,
                                                  graph_namespace_oid);
         /* open the relation (table) and begin the scan */
-        graph_edge_label = table_open(edge_label_table_oid, ShareLock);
+        graph_edge_label = table_open(edge_label_table_oid, AccessShareLock);
         scan_desc = table_beginscan(graph_edge_label, snapshot, 0, NULL);
         /* get the tupdesc - we don't need to release this one */
         tupdesc = RelationGetDescr(graph_edge_label);
@@ -678,7 +678,7 @@ static void load_edge_hashtable(GRAPH_global_context *ggctx)
 
         /* end the scan and close the relation */
         table_endscan(scan_desc);
-        table_close(graph_edge_label, ShareLock);
+        table_close(graph_edge_label, AccessShareLock);
     }
 }
 

Reply via email to