On Fri, Mar 4, 2022 at 10:04 PM Kyotaro Horiguchi
<horikyota.ntt@gmail.com> wrote:
> And I made a quick hack on do_pg_start_backup. And I found that
> pg_basebackup copies in-place tablespaces under the *current
> directory*, which is not ok at all:(
Hmm. Which OS are you on? Looks OK here -- the "in place" tablespace
gets copied as a directory under pg_tblspc, no symlink:
postgres=# set allow_in_place_tablespaces = on;
SET
postgres=# create tablespace ts1 location '';
CREATE TABLESPACE
postgres=# create table t (i int) tablespace ts1;
CREATE TABLE
postgres=# insert into t values (1), (2);
INSERT 0 2
postgres=# create user replication replication;
CREATE ROLE
$ pg_basebackup --user replication -D pgdata2
$ ls -slaph pgdata/pg_tblspc/
total 4.0K
0 drwx------ 3 tmunro tmunro 19 Mar 4 23:16 ./
4.0K drwx------ 19 tmunro tmunro 4.0K Mar 4 23:16 ../
0 drwx------ 3 tmunro tmunro 29 Mar 4 23:16 16384/
$ ls -slaph pgdata2/pg_tblspc/
total 4.0K
0 drwx------ 3 tmunro tmunro 19 Mar 4 23:16 ./
4.0K drwx------ 19 tmunro tmunro 4.0K Mar 4 23:16 ../
0 drwx------ 3 tmunro tmunro 29 Mar 4 23:16 16384/
$ ls -slaph pgdata/pg_tblspc/16384/PG_15_202203031/5/
total 8.0K
0 drwx------ 2 tmunro tmunro 19 Mar 4 23:16 ./
0 drwx------ 3 tmunro tmunro 15 Mar 4 23:16 ../
8.0K -rw------- 1 tmunro tmunro 8.0K Mar 4 23:16 16385
$ ls -slaph pgdata2/pg_tblspc/16384/PG_15_202203031/5/
total 8.0K
0 drwx------ 2 tmunro tmunro 19 Mar 4 23:16 ./
0 drwx------ 3 tmunro tmunro 15 Mar 4 23:16 ../
8.0K -rw------- 1 tmunro tmunro 8.0K Mar 4 23:16 16385
The warning from readlink() while making the mapping file isn't ideal,
and perhaps we should suppress that with something like the attached.
Or does the missing map file entry break something on Windows?