pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
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-003IzU-Se@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
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/112d055706bfe653685ec24552429a19830a7ef3

Modified Files
--------------
src/backend/commands/sequence.c | 7 +++++++
1 file changed, 7 insertions(+)



view thread (3+ messages)  latest in thread

Message-ID: <E1sN1K9-003IzU-Se@gemulon.postgresql.org>
Permalink:  ../E1sN1K9-003IzU-Se@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sN1K9-003IzU-Se@gemulon.postgresql.org

 · 

reply

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-003IzU-Se@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