From: | BharatDB <bharatdbpg(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: GRANT/REVOKE locking semantics in get_object_address() |
Date: | 2025-08-28 13:21:15 |
Message-ID: | CAAh00ERb5W4xpAzy0t6uLj+R7UR+feHMj8_ik=y63-tgRz49Xg@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Dear Team,
With reference to the conversation ongioing in message ID:
d2d96fe4-6b1c-4bd3-813b-c2cfcb4a79f4, I am writing to express my interest
in contributing to the ongoing work on fixing the bug related to Proper
object locking for GRANT/REVOKE.
I have been following the discussion around the recent changes where
get_object_address() now acquires locks during GRANT/REVOKE.
To help visualize the trade-offs, I prepared an isolation test comparing
AccessShareLock (current PG18 behavior) and ShareUpdateExclusiveLock
(hypothetical alternative). The attached .spec and .out files show the
results.
*Summary of outcomes:*
-
*AccessShareLock (PG18):*
-
Session A: holds ACCESS SHARE
-
Session B: GRANT waits until A commits
-
Session C: plain SELECT proceeds normally (not blocked)
-
*ShareUpdateExclusiveLock (hypothetical):*
-
Session A: holds SHARE UPDATE EXCLUSIVE
-
Session B: GRANT waits until A commits
-
Session C: plain SELECT is also blocked (autovacuum and readers
delayed)
So the stronger lock would block normal readers/autovacuum, which feels too
heavy for GRANT/REVOKE.
This test outcome seems to confirm the reasoning that Noah and Nathan
outlined - AccessShareLock avoids surprising contention, even though some
races remain possible.
Would it make sense to add an isolation test like this (at least for
documentation and regression coverage), to preserve visibility on the
chosen trade-off?
Regards,
Athiyaman
Attachment | Content-Type | Size |
---|---|---|
grant_lock_modes.out | application/octet-stream | 377 bytes |
grant_lock_modes.spec | text/x-rpm-spec | 729 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Álvaro Herrera | 2025-08-28 13:23:07 | Re: pgsql: Move SQL-callable code related to multixacts into its own file |
Previous Message | Andrew Jackson | 2025-08-28 13:05:34 | Re: Adding pg_dump flag for parallel export to pipes |