pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Don't skip invalid databases when enabling data checksums
2+ messages / 1 participants
[nested] [flat]

* pgsql: Don't skip invalid databases when enabling data checksums
@ 2026-08-03 18:52  Daniel Gustafsson <dgustafsson@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Daniel Gustafsson @ 2026-08-03 18:52 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6a6e99f859db1163a3646eaf8e47f865312dfc07

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Don't skip invalid databases when enabling data checksums
@ 2026-08-03 18:53  Daniel Gustafsson <dgustafsson@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Daniel Gustafsson @ 2026-08-03 18:53 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-08-03 18:53 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-08-03 18:52 pgsql: Don't skip invalid databases when enabling data checksums Daniel Gustafsson <dgustafsson@postgresql.org>
2026-08-03 18:53 pgsql: Don't skip invalid databases when enabling data checksums Daniel Gustafsson <dgustafsson@postgresql.org>

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