Recheck checksum state before file_copy during CREATE DATABASE The file_copy strategy check in createdb() runs during option validation, before the transaction has an XID and before the pg_database row exists, so the datachecksumsworker launcher can start in that window and see neither the new database nor the transaction creating it. It then raw-copies a template that was not processed yet, and those files stay unchecksummed, failing verification from then on.
Recheck the state in CreateDatabaseUsingFileCopy(): the XID is assigned by then, so a launcher starting after this point waits for the transaction and finds the new database, and the copy errors out instead. Add an injection point before the catalog insert to test the window. Backpatch to v19 where online checksums were introduced. Author: Zsolt Parragi <[email protected]> Reviewed-by: Daniel Gustafsson <[email protected]> Discussion: https://postgr.es/m/can4czfpebsz8jey4ixq1v4zl_xoy6pjazs8zlgh7r+wf--p...@mail.gmail.com Backpatch-through: 19 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9eb77f9fc80db071b434aea58681ed2adb9038d3 Modified Files -------------- src/backend/commands/dbcommands.c | 28 +++++++++ src/test/modules/test_checksums/t/005_injection.pl | 68 ++++++++++++++++++++++ 2 files changed, 96 insertions(+)
