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
signature.asc
Description: PGP signature