Re: [Patch] Make pg_checksums skip foreign tablespace directories
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Michael Banck <michael.banck@credativ.de>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2020-01-31T04:53:52Z
Lists: pgsql-hackers
Attachments
- exclude-prefix-filter.patch (text/x-diff) patch
On Thu, Jan 30, 2020 at 06:11:22PM +0100, Michael Banck wrote: > The other question is whether it is possible to end up with a > pg_internal.init.$PID file in a running cluster. E.g. if an instance > crashes and gets started up again - are those cleaned up during crash > recovery, or should pg_checksums ignore them? Right now pg_checksums > only checks against a list of filenames and only skips on exact matches > not prefixes so that might take a bit of work. Indeed, with a bad timing and a crash in the middle of write_relcache_init_file(), it could be possible to have such a file left around in the data folder. Having a past tablespace version left around after an upgrade is a pilot error in my opinion because pg_upgrade generates a script to cleanup past tablespaces, no? So your patch does not look like a good idea to me. And now that I look at it, if we happen to leave behind a temporary file for pg_internal.init, backups fail with the following error: 2020-01-31 13:26:18.345 JST [102076] 010_pg_basebackup.pl ERROR: invalid segment number 0 in file "pg_internal.init.123" So, I think that it would be better to change basebackup.c, pg_checksums and pg_rewind so as files are excluded if there is a prefix match with the exclude lists. Please see the attached. -- Michael
Commits
-
Skip foreign tablespaces when running pg_checksums/pg_verify_checksums
- 8f9aba1874ec 11.8 landed
- f6e8e8b3809b 12.3 landed
- 428a2609ef64 13.0 landed
-
Add prefix checks in exclude lists for pg_rewind, pg_checksums and base backups
- da2a7180aa0e 11.8 landed
- a8beece956eb 12.3 landed
- bf883b211eae 13.0 landed