pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Lock owned sequences during ALTER TABLE SET { LOGGED | UNLOGGED
3+ messages / 1 participants
[nested] [flat]
* pgsql: Lock owned sequences during ALTER TABLE SET { LOGGED | UNLOGGED
@ 2024-06-28 02:26 Noah Misch <noah@leadboat.com>
0 siblings, 0 replies; 3+ messages in thread
From: Noah Misch @ 2024-06-28 02:26 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Lock owned sequences during ALTER TABLE SET { LOGGED | UNLOGGED }.
These commands already make the persistence of owned sequences follow
owned table persistence changes. They didn't lock those sequences.
They lost the effect of nextval() calls that other sessions make after
the ALTER TABLE command, before the ALTER TABLE transaction commits.
Fix by acquiring the same lock that ALTER SEQUENCE SET { LOGGED |
UNLOGGED } acquires. This might cause more deadlocks. Back-patch to
v15, where commit 344d62fb9a978a72cf8347f0369b9ee643fd0b31 introduced
unlogged sequences.
Reviewed (in an earlier version) by Robert Haas.
Discussion: https://postgr.es/m/20240611024525.9f.nmisch@google.com
Branch
------
REL_16_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/112d055706bfe653685ec24552429a19830a7ef3
Modified Files
--------------
src/backend/commands/sequence.c | 7 +++++++
1 file changed, 7 insertions(+)
^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Lock owned sequences during ALTER TABLE SET { LOGGED | UNLOGGED
@ 2024-06-28 02:26 Noah Misch <noah@leadboat.com>
0 siblings, 0 replies; 3+ messages in thread
From: Noah Misch @ 2024-06-28 02:26 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Lock owned sequences during ALTER TABLE SET { LOGGED | UNLOGGED }.
These commands already make the persistence of owned sequences follow
owned table persistence changes. They didn't lock those sequences.
They lost the effect of nextval() calls that other sessions make after
the ALTER TABLE command, before the ALTER TABLE transaction commits.
Fix by acquiring the same lock that ALTER SEQUENCE SET { LOGGED |
UNLOGGED } acquires. This might cause more deadlocks. Back-patch to
v15, where commit 344d62fb9a978a72cf8347f0369b9ee643fd0b31 introduced
unlogged sequences.
Reviewed (in an earlier version) by Robert Haas.
Discussion: https://postgr.es/m/20240611024525.9f.nmisch@google.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/f88cdb36c457f673a1966a22883ce47e565a37db
Modified Files
--------------
src/backend/commands/sequence.c | 7 +++++++
1 file changed, 7 insertions(+)
^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Lock owned sequences during ALTER TABLE SET { LOGGED | UNLOGGED
@ 2024-06-28 02:26 Noah Misch <noah@leadboat.com>
0 siblings, 0 replies; 3+ messages in thread
From: Noah Misch @ 2024-06-28 02:26 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Lock owned sequences during ALTER TABLE SET { LOGGED | UNLOGGED }.
These commands already make the persistence of owned sequences follow
owned table persistence changes. They didn't lock those sequences.
They lost the effect of nextval() calls that other sessions make after
the ALTER TABLE command, before the ALTER TABLE transaction commits.
Fix by acquiring the same lock that ALTER SEQUENCE SET { LOGGED |
UNLOGGED } acquires. This might cause more deadlocks. Back-patch to
v15, where commit 344d62fb9a978a72cf8347f0369b9ee643fd0b31 introduced
unlogged sequences.
Reviewed (in an earlier version) by Robert Haas.
Discussion: https://postgr.es/m/20240611024525.9f.nmisch@google.com
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/24561b498f117fc7ec58baba27b0d89c9efab376
Modified Files
--------------
src/backend/commands/sequence.c | 7 +++++++
1 file changed, 7 insertions(+)
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2024-06-28 02:26 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-06-28 02:26 pgsql: Lock owned sequences during ALTER TABLE SET { LOGGED | UNLOGGED Noah Misch <noah@leadboat.com>
2024-06-28 02:26 pgsql: Lock owned sequences during ALTER TABLE SET { LOGGED | UNLOGGED Noah Misch <noah@leadboat.com>
2024-06-28 02:26 pgsql: Lock owned sequences during ALTER TABLE SET { LOGGED | UNLOGGED Noah Misch <noah@leadboat.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox