yjhjstz commented on code in PR #1845:
URL: https://github.com/apache/cloudberry/pull/1845#discussion_r3550455746
##########
src/backend/commands/resgroupcmds.c:
##########
@@ -715,47 +715,25 @@ GetResGroupIdForRole(Oid roleid)
{
HeapTuple tuple;
Oid groupId;
- bool isNull;
- Relation rel;
- ScanKeyData key;
- SysScanDesc sscan;
-
- rel = table_open(AuthIdRelationId, AccessShareLock);
-
- ScanKeyInit(&key,
- Anum_pg_authid_oid,
- BTEqualStrategyNumber, F_OIDEQ,
- ObjectIdGetDatum(roleid));
-
- sscan = systable_beginscan(rel, AuthIdOidIndexId, true, NULL, 1, &key);
+ bool isNull = true;
- tuple = systable_getnext(sscan);
+ /*
+ * Prefer syscache lookup to avoid taking explicit catalog scan/snapshot
+ * which may install xmin in the current process. Use the AUTHOID
+ * syscache to fetch pg_authid tuple for the given role Oid.
+ */
+ tuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid));
Review Comment:
Can you add related test `create index concurrently t_idx on t(a, b);` ?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]