| From: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
|---|---|
| To: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org, shihao zhong <zhong950419(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com> |
| Subject: | Re: DROP USER MAPPING doesn't acquire lock on its server |
| Date: | 2026-12-03 22:52:32 |
| Message-ID: | CAN4CZFNEk4EgaUCy2E91GUBhCgSgnquOmXQXNojC6F99gDUxLA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hello
+/*
+ * GetForeignServerByNameLocked - look up a foreign server by name and lock it.
+ *
+ * The lock protects the server from concurrent deletion after resolving its
+ * name but before fetching its catalog tuple by OID.
+ */
+ForeignServer *
+GetForeignServerByNameLocked(const char *srvname, LOCKMODE lockmode,
+ bool missing_ok)
Is this the right solution for a possibly backpatchable fix? It's a
new public function, undocumented (GetForeignServerByName is mentioned
in fdwhandler.sgml), and adds a circular dependency between
foreign.h/c and objectaddress.h/c.
+ * The lock protects the server from concurrent deletion after resolving its
+ * name but before fetching its catalog tuple by OID.
+ */
Why do we have to lock for that? Isn't this a bug/issue with
GetForeignServerByName that should be fixed? That currently it
performs 2 syscache lookups, when 1 should be enough, and then we
can't have any inconsistency.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Baji Shaik | 2026-12-03 22:54:58 | Re: pg_dump writes a subscription's default slot name, which can't be restored |
| Previous Message | Zsolt Parragi | 2026-12-03 22:36:13 | Re: Incorrect selectivity estimates for NOT on nullable boolean columns |