agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Daniel Gustafsson <dgustafsson@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Don't skip invalid databases when enabling data checksums
Date: Mon, 03 Aug 2026 18:53:29 +0000
Message-ID: <E1wqxmz-0000000031O-3D5G@gemulon.postgresql.org> (raw)
Don't skip invalid databases when enabling data checksums
When enabling checksums cannot process a database, the launcher uses
DatabaseExists to tell a concurrent drop (benign) from a real failure.
Since 1df361e3d82 that check also treats a present, but-invalid, data-
base as non-existent. An interrupted DROP DATABASE flush the invalid
marker before the row and files are removed, so a crash or ERROR can
leave an invalid row whose files remain on disk.
Report a database as existing whenever its catalog row is found to
ensure that checksums cannot be enabled if there are invalid databases.
The AccessShareLock in DatabaseExists already waits out an in-flight
drop, so an invalid-but-present row can only be an interrupted drop
leftover whose files still need checksums; enabling then aborts until
it is dropped.
Backpatch to v19 where online checksums were introduced.
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/CAN4CZFOGdqxtZ5-6gb4apqmvoH=Z+TNH8RKJ3mVtoR1HirKQWg@mail.gmail.com
Backpatch-through: 19
Branch
------
REL_19_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/343d98c3601abf3060ff82b7b2a8bc7903105bf3
Modified Files
--------------
src/backend/commands/dbcommands.c | 2 +
src/backend/postmaster/datachecksum_state.c | 29 ++++------
src/test/modules/test_checksums/t/005_injection.pl | 63 ++++++++++++++++++++++
3 files changed, 75 insertions(+), 19 deletions(-)
view thread (2+ messages)
Message-ID: <E1wqxmz-0000000031O-3D5G@gemulon.postgresql.org>
Permalink: ../E1wqxmz-0000000031O-3D5G@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1wqxmz-0000000031O-3D5G@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: dgustafsson@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Don't skip invalid databases when enabling data checksums
In-Reply-To: <E1wqxmz-0000000031O-3D5G@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox