Re: Teach pg_upgrade to deal with invalid databases

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Robert Treat <rob(at)xzilla(dot)net>, Andres Freund <andres(at)anarazel(dot)de>, Rithvika Devisetti <devisettirithvika(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Teach pg_upgrade to deal with invalid databases
Date: 2026-11-12 17:04:35
Message-ID: CALj2ACWWb1G86JX6HehGbrFLPQF3rH1O6SkZmCx4s+67ENCtLA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, Nov 5, 2026 at 7:25 AM Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
>
> Here is what I have staged for commit, which I'm planning to do soon.

Thanks for taking care of this, and sorry for the delay.

> Thinking ahead to the automatic deletion project, I wonder if we should
> make DROP DATABASE work more like CHECKPOINT. That is, it would mark the
> database for deletion, but another process would do the actual work. That
> way, dropping a database follows the same path every time, regardless of
> whether the DROP command was interrupted. This would also open the door
> for a DROP DATABASE option to initiate the drop without waiting for it to
> complete, although I'm admittedly not sure that has many use-cases.

Interesting. So it's essentially an async drop database. The database
is marked dropped in the catalogs and acked to the client, while
resource removal is deferred to a bg worker. If my understanding is
right, that would need a new mechanism for clients to confirm the
resources (e.g., files) are actually gone and the drop truly
succeeded, which feels like a whole new behavior.

Also, invalid databases are uncommon in practice, so letting a bg
worker (checkpointer, a new custodian worker, or a dynamic worker)
clean up the remains seems like the simpler choice to me.
https://postgr.es/m/20230509040203.z6mvijumv7wxcuib%40awork3.anarazel.de

--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Srinath Reddy Sadipiralla 2026-11-12 16:28:04 Re: pg_rewind: Remove recovery at the start of rewind