diff --git a/src/bin/pg_rewind/libpq_source.c b/src/bin/pg_rewind/libpq_source.c index 0d8e9ee2d1..f449b8887e 100644 --- a/src/bin/pg_rewind/libpq_source.c +++ b/src/bin/pg_rewind/libpq_source.c @@ -298,7 +298,16 @@ libpq_traverse_files(rewind_source *source, process_file_callback_t callback) link_target = PQgetvalue(res, i, 3); if (link_target[0]) - type = FILE_TYPE_SYMLINK; + { + /* + * For in-place tablespace, link_target is a directory which starts + * with "pg_tblspc/". + */ + if (strncmp(link_target, "pg_tblspc/", strlen("pg_tblspc/")) == 0) + type = FILE_TYPE_DIRECTORY; + else + type = FILE_TYPE_SYMLINK; + } else if (isdir) type = FILE_TYPE_DIRECTORY; else diff --git a/src/bin/pg_rewind/t/001_basic.pl b/src/bin/pg_rewind/t/001_basic.pl index 031594e14e..e1ee7d21e1 100644 --- a/src/bin/pg_rewind/t/001_basic.pl +++ b/src/bin/pg_rewind/t/001_basic.pl @@ -18,6 +18,9 @@ sub run_test RewindTest::setup_cluster($test_mode); RewindTest::start_primary(); + # Create an in-place tablespace + primary_psql("CREATE TABLESPACE test LOCATION ''"); + # Create a test table and insert a row in primary. primary_psql("CREATE TABLE tbl1 (d text)"); primary_psql("INSERT INTO tbl1 VALUES ('in primary')"); diff --git a/src/bin/pg_rewind/t/RewindTest.pm b/src/bin/pg_rewind/t/RewindTest.pm index 4957791e94..8fbbd521cb 100644 --- a/src/bin/pg_rewind/t/RewindTest.pm +++ b/src/bin/pg_rewind/t/RewindTest.pm @@ -131,6 +131,7 @@ sub setup_cluster $node_primary->append_conf( 'postgresql.conf', qq( wal_keep_size = 320MB +allow_in_place_tablespaces = on )); return; }