sandy-bes commented on code in PR #2351:
URL: https://github.com/apache/age/pull/2351#discussion_r3013702547
##########
src/backend/catalog/ag_label.c:
##########
@@ -297,49 +298,111 @@ List *get_all_edge_labels_per_graph(EState *estate, Oid
graph_oid)
HeapTuple tuple;
TupleTableSlot *slot;
ResultRelInfo *resultRelInfo;
-
- /* setup scan keys to get all edges for the given graph oid */
- ScanKeyInit(&scan_keys[1], Anum_ag_label_graph, BTEqualStrategyNumber,
- F_OIDEQ, ObjectIdGetDatum(graph_oid));
- ScanKeyInit(&scan_keys[0], Anum_ag_label_kind, BTEqualStrategyNumber,
- F_CHAREQ, CharGetDatum(LABEL_TYPE_EDGE));
+ Oid index_oid;
/* setup the table to be scanned */
- ag_label = table_open(ag_label_relation_id(), RowExclusiveLock);
- scan_desc = table_beginscan(ag_label, estate->es_snapshot, 2, scan_keys);
+ ag_label = table_open(ag_label_relation_id(), AccessShareLock);
+
+ index_oid = find_usable_index_for_attr(ag_label, Anum_ag_label_graph);
resultRelInfo = create_entity_result_rel_info(estate, "ag_catalog",
"ag_label");
Review Comment:
I see exactly what you mean now: the code explicitly does table_open with
AccessShareLock, and then create_entity_result_rel_info opens the exact same
relation again via parserOpenTable with RowExclusiveLock.
This is actually existing code that I didn't write. To keep the PR focused
and avoid breaking existing logic, I didn't change its internal mechanics. Let
me know if you'd still prefer me to fix it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]