Skip to content

Commit c6f2f01

Browse files
committed
Fix pg_basebackup with in-place tablespaces.
Previously, pg_basebackup from a cluster that contained an 'in-place' tablespace, as introduced by commit 7170f21, would produce a harmless warning on Unix and fail completely on Windows. Reported-by: Kyotaro Horiguchi <[email protected]> Reviewed-by: Kyotaro Horiguchi <[email protected]> Reviewed-by: Michael Paquier <[email protected]> Discussion: https://postgr.es/m/20220304.165449.1200020258723305904.horikyota.ntt%40gmail.com
1 parent 9dde828 commit c6f2f01

File tree

1 file changed

+14
-0
lines changed
  • src/backend/access/transam

1 file changed

+14
-0
lines changed

src/backend/access/transam/xlog.c

+14
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
#include "catalog/pg_control.h"
6767
#include "catalog/pg_database.h"
6868
#include "common/controldata_utils.h"
69+
#include "common/file_utils.h"
6970
#include "executor/instrument.h"
7071
#include "miscadmin.h"
7172
#include "pg_trace.h"
@@ -8292,6 +8293,19 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p,
82928293

82938294
snprintf(fullpath, sizeof(fullpath), "pg_tblspc/%s", de->d_name);
82948295

8296+
/*
8297+
* Skip anything that isn't a symlink/junction. For testing only,
8298+
* we sometimes use allow_in_place_tablespaces to create
8299+
* directories directly under pg_tblspc, which would fail below.
8300+
*/
8301+
#ifdef WIN32
8302+
if (!pgwin32_is_junction(fullpath))
8303+
continue;
8304+
#else
8305+
if (get_dirent_type(fullpath, de, false, ERROR) != PGFILETYPE_LNK)
8306+
continue;
8307+
#endif
8308+
82958309
#if defined(HAVE_READLINK) || defined(WIN32)
82968310
rllen = readlink(fullpath, linkpath, sizeof(linkpath));
82978311
if (rllen < 0)

0 commit comments

Comments
 (0)