| From: | Noah Misch <noah(at)leadboat(dot)com> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Avoid "you don't own a lock of type ExclusiveLock" in GRANT TABL |
| Date: | 2024-11-25 22:43:34 |
| Message-ID: | E1tFhnq-003WcD-Su@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Avoid "you don't own a lock of type ExclusiveLock" in GRANT TABLESPACE.
This WARNING appeared because SearchSysCacheLocked1() read
cc_relisshared before catcache initialization, when the field is false
unconditionally. On the basis of reading false there, it constructed a
locktag as though pg_tablespace weren't relisshared. Only shared
catalogs could be affected, and only GRANT TABLESPACE was affected in
practice. SearchSysCacheLocked1() callers use one other shared-relation
syscache, DATABASEOID. DATABASEOID is initialized by the end of
CheckMyDatabase(), making the problem unreachable for pg_database.
Back-patch to v13 (all supported versions). This has no known impact
before v16, where ExecGrant_common() first appeared. Earlier branches
avoid trouble by having a separate ExecGrant_Tablespace() that doesn't
use LOCKTAG_TUPLE. However, leaving this unfixed in v15 could ensnare a
future back-patch of a SearchSysCacheLocked1() call.
Reported by Aya Iwata.
Discussion: https://postgr.es/m/OS7PR01MB11964507B5548245A7EE54E70EA212@OS7PR01MB11964.jpnprd01.prod.outlook.com
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/941e0c0df2bcdeb63bd822a1c46818fa9d7d8599
Modified Files
--------------
src/backend/utils/cache/syscache.c | 15 ++++++++++-----
src/test/regress/expected/tablespace.out | 5 +++++
src/test/regress/sql/tablespace.sql | 6 ++++++
3 files changed, 21 insertions(+), 5 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2024-11-25 23:10:00 | pgsql: Fix NULLIF()'s handling of read-write expanded objects. |
| Previous Message | Nathan Bossart | 2024-11-25 22:38:41 | pgsql: pg_dump: Add dumpSchema and dumpData derivative flags. |