From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Lock owned sequences during ALTER TABLE SET { LOGGED | UNLOGGED
Date: Fri, 28 Jun 2024 02:26:54 +0000
Message-ID: <E1sN1K9-003Iz8-Oo@gemulon.postgresql.org> (raw)
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(+)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: noah@leadboat.com, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Lock owned sequences during ALTER TABLE SET { LOGGED | UNLOGGED
In-Reply-To: <E1sN1K9-003Iz8-Oo@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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