The following bug has been logged on the website:
Bug reference: 15092
Logged by: Martin Visser
Email address: mvisser(at)hotmail(dot)com
PostgreSQL version: 9.6.2
Operating system: OSX
Description:
I want to take regular backups on the standby machine using pg_basebackup.
Using pg_basebackup on the non-master machine fails when using tablespaces
and the tablespace directory already exists on the secondary machine.
pg_basebackup: directory "/db/ts1" exists but is not empty