pg_basebackup fails on Windows when using tablespace mapping

From: nb <nbedxp(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: pg_basebackup fails on Windows when using tablespace mapping
Date: 2017-06-26 16:57:11
Message-ID: 4e641357-69bb-d09b-9174-cb08facb94b8@gmail.com
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

Summary:

Trying to take a `pg_basebackup -T OLDDIR=NEWDIR [etc]` on master
(server running the cluster) fails on Windows with error "pg_basebackup:
directory "OLDDIR" exists but is not empty".

Version: 9.6.2, installed from Standard EDB package (built with MSVC).

Repro steps:

1. Have a cluster running on Windows (you'll need max_wal_senders at
least 2 and wal_level replica for pg_basebackup -X stream)

2. create tablespace testspc location 'somedisk:\some\location'; --
Slash direction is irrelevant

3. run `pg_basebackup -T somedisk:\some\location=somedisk:\new\location
-X stream -D somedisk:\some\other_location -h 127.0.0.1 -U postgres`

The error should read:

pg_basebackup: directory "somedisk:\some\location" exists but is not empty

---

This was discussed today in IRC. As a temporary solution it was
suggested to add 'canonicalize_path(buf);' before return in
/src/port/dirmod.c:336

** DISCLAMER: note that value of r is not adjusted, so this is not a
production ready fix in any way. **

This fixed the issue, but as a side effect, pg_tablespace_location
displays path in canonicalized format which might look weird to most
Windows users.

There was a suggestion to fix this in client instead, but this fix was
the simplest one to implement.

This is my first post to Hackers, so please let me know if I missed
something or can provide any additional info to help further investigate
this issue.

Kind regards,

Nick.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeevan Ladhe 2017-06-26 17:38:19 Re: fix empty array expression in get_qual_for_list()
Previous Message Andres Freund 2017-06-26 16:46:59 Re: Another reason why the recovery tests take a long time