Handle invalid and dropped databases during checksum enable

Enable errors out early with a hint when an invalid database exists,
since the worker cannot connect to it and its files stay on disk.

A worker that started but failed gets the same dropped-database
heuristic as one that failed to start, so a concurrent drop during
processing no longer aborts the whole run.  The existence check locks
the database first, otherwise a DROP DATABASE ... WITH (FORCE) which
killed the worker is still only halfway done and the database looks
like it is there to stay.

Backpatch to v19 where online checksums were introduced.

Author: Zsolt Parragi <[email protected]>
Reviewed-by: Daniel Gustafsson <[email protected]>
Discussion: 
https://postgr.es/m/CAN4CZFOGdqxtZ5-6gb4apqmvoH=z+tnh8rkj3mvtor1hirk...@mail.gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e469e4784ea9f632b91e5d988cd336cbf54af58a

Modified Files
--------------
src/backend/postmaster/datachecksum_state.c    |  71 +++++++++++++++
src/test/modules/test_checksums/t/001_basic.pl | 121 +++++++++++++++++++++++++
2 files changed, 192 insertions(+)

Reply via email to