Re: datachecksums: handle invalid and dropped databases during enable

From: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: datachecksums: handle invalid and dropped databases during enable
Date: 2026-08-03 12:14:17
Message-ID: CAJTYsWVc3o88BXFfDrBCdR=P0fo5-HF0QJpiTvmvWr7dda8isg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Fri, 31 Jul 2026 at 03:32, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
wrote:

> > Apologies if this is expected behaviour, and I missed on some thread
> > mentioning it.
>
> It was somewhat intentional, but I agree that it is inconsistent and
> maybe we should improve it.
>
> The original code wanted to skip invalid databases, but also failed
> because it tried connecting to them before this check. I fixed the
> connection failure, but I also added a startup check about having no
> invalid databases, because completing checksum enablement while there
> are invalid databases didn't seem entirely safe. This seemed like a
> good compromise because I wanted to avoid surprise process stops, but
> since a failing drop database happening during the processing is
> unlikely, handling this properly shouldn't be a real problem.
>
> We could improve this either by adding your patch, or by removing
> ErrorOnInvalidDatabases, but adding this patch seems to be safer to
> me.

I lean the same way. ISTM the startup check and this change enforce the
same rule from two ends: don't let enablement finish while an invalid
database still has files on disk, whether it was invalid at startup or
turned invalid during processing. Dropping ErrorOnInvalidDatabases would
lose the early, actionable error for the startup case, so keeping it and
handling the mid-run case seems the more consistent option.

I've added a CF entry to track this [1], probably need to change the title.

Regards,
Ayush

[1] https://commitfest.postgresql.org/patch/7087/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2026-08-03 12:21:48 [PATCH] Remove unused PartitionDescData.last_found_part_index field
Previous Message Ayush Tiwari 2026-08-03 12:00:51 Re: Add a pg_wal_preallocate() SQL function to eagerly create future WAL segments