From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Bernd Helmle <mailings(at)oopsware(dot)de> |
Cc: | Michael Banck <michael(dot)banck(at)credativ(dot)de>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [Patch] Make pg_checksums skip foreign tablespace directories |
Date: | 2020-02-21 06:36:11 |
Message-ID: | 20200221063611.GE3260@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Feb 20, 2020 at 05:38:15PM +0100, Bernd Helmle wrote:
> 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.
+ if (S_ISREG(st.st_mode))
+ {
+ pg_log_debug("ignoring file %s in pg_tblspc", de->d_name);
+ continue;
+ }
We don't do that for the normal directory scan path, so it does not
strike me as a good idea on consistency ground. As a whole, I don't
see much point in having a separate routine which is just roughly a
duplicate of scan_directory(), and I think that we had better just add
the check looking for matches with TABLESPACE_VERSION_DIRECTORY
directly when having a directory, if subdir is "pg_tblspc". That
also makes the patch much shorter.
+ * the direct path to it and check via lstat wether it exists.
s/wether/whether/, repeated three times.
We should have some TAP tests for that. The first patch of this
thread from Michael had some, but I would just have added a dummy
tablespace with an empty file in 002_actions.pl, triggering an error
if pg_checksums is not fixed. Dummy entries around the place where
dummy temp files are added would be fine.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Prabhat Sahu | 2020-02-21 07:45:44 | Re: [Proposal] Global temporary tables |
Previous Message | Anders Åstrand | 2020-02-21 06:29:26 | Re: PATCH: Add uri percent-encoding for binary data |