pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix creation of partition descriptor during concurrent detach
Date: Tue, 11 Jun 2024 09:52:41 +0000
Message-ID: <E1sGyBE-000zsK-6z@gemulon.postgresql.org> (raw)

Fix creation of partition descriptor during concurrent detach

When a partition is being detached in concurrent mode, it is possible
for find_inheritance_children_extended() to return that partition in the
list, and immediately after that receive an invalidation message that
sets its relpartbound to NULL just before we read it.  (This can happen
because table_open() reads invalidation messages.)  Currently we raise
an error
  ERROR:  missing relpartbound for relation %u
about the situation, but that's bogus because the table is no longer a
partition, so we shouldn't be complaining about it.  A better reaction
is to retry the find_inheritance_children_extended call to get a new
list, which will no longer have the partition being detached.

Noticed while investigating bug #18377.

Backpatch to 14, where DETACH CONCURRENTLY appeared.

Discussion: https://postgr.es/m/202405201616.y4ht2qe5ihoy@alvherre.pgsql

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5dcaefc6a0cf35e3afed0a38216a463d736fff5b

Modified Files
--------------
src/backend/partitioning/partdesc.c | 53 ++++++++++++++++++++++++++++---------
1 file changed, 40 insertions(+), 13 deletions(-)



view thread (11+ messages)  latest in thread

Message-ID: <E1sGyBE-000zsK-6z@gemulon.postgresql.org>
Permalink:  ../E1sGyBE-000zsK-6z@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sGyBE-000zsK-6z@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: alvherre@alvh.no-ip.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix creation of partition descriptor during concurrent detach
  In-Reply-To: <E1sGyBE-000zsK-6z@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