Re: [Patch] Make pg_checksums skip foreign tablespace directories
От | Bernd Helmle |
---|---|
Тема | Re: [Patch] Make pg_checksums skip foreign tablespace directories |
Дата | |
Msg-id | 6da2aa101c4c76d9851db0486dc9f95f2d0a95df.camel@oopsware.de обсуждение исходный текст |
Ответ на | Re: [Patch] Make pg_checksums skip foreign tablespace directories (Michael Paquier <michael@paquier.xyz>) |
Ответы |
Re: [Patch] Make pg_checksums skip foreign tablespace directories
|
Список | pgsql-hackers |
Am Dienstag, den 18.02.2020, 15:15 +0900 schrieb Michael Paquier: > Fair point. Now, while the proposed patch is right to use > TABLESPACE_VERSION_DIRECTORY, shouldn't we use strncmp based on the > length of TABLESPACE_VERSION_DIRECTORY instead of de->d_name? It > seems also to me that the code as proposed is rather fragile, and > that > we had better be sure that the check only happens when we are > scanning > entries within pg_tblspc. > Yes, after thinking and playing around with it a little i share your position. You can still easily cause pg_checksums to error out by just having arbitrary files around in the reference tablespace locations. Though i don't think this is something of a big issue, it looks strange and misleading if pg_checksums just complains about files not belonging to the scanned PostgreSQL data directory (even we explicitly note in the docs that even tablespace locations are somehow taboo for DBAs to put other files and/or directories in there). So i propose a different approach like the attached patch tries to implement: instead of just blindly iterating over directory contents and filter them out, reference the tablespace location and TABLESPACE_VERSION_DIRECTORY directly. This is done by a new function scan_tablespaces() which is specialized in just follow the symlinks/junctions in pg_tblspc and call scan_directory() with just what it has found there. It will also honour directories, just in case an experienced DBA has copied over the tablespace into pg_tblspc directly. > The issue with pg_internal.init.XX is quite different, so I think > that > it would be better to commit that separately first. Agreed. Thanks, Bernd
Вложения
В списке pgsql-hackers по дате отправления: