Re: [Patch] Make pg_checksums skip foreign tablespace directories - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [Patch] Make pg_checksums skip foreign tablespace directories
Date
Msg-id 20200131045352.GB2631@paquier.xyz
Whole thread Raw
In response to [Patch] Make pg_checksums skip foreign tablespace directories  (Michael Banck <michael.banck@credativ.de>)
Responses Re: [Patch] Make pg_checksums skip foreign tablespace directories  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Re: [Patch] Make pg_checksums skip foreign tablespace directories  (Michael Banck <michael.banck@credativ.de>)
Re: [Patch] Make pg_checksums skip foreign tablespace directories  (Bernd Helmle <mailings@oopsware.de>)
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: table partitioning and access privileges
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: Proposal: Add more compile-time asserts to exposeinconsistencies.