Skip to content

Commit 202b56b

Browse files
committed
Remove unnecessary Windows-specific basebackup code.
Commit c6f2f01 added an explicit check for a Windows "junction point". That turned out to be needed only because get_dirent_type() was busted on Windows. It's been fixed by commit 9d3444d, so remove it. Add a TAP-test to demonstrate that in-place tablespaces are copied by pg_basebackup. This exercises the codepath that would fail before c6f2f01 on Windows, and shows that it still doesn't fail now that we're using get_dirent_type() on both Windows and Unix. Back-patch to 15, where in-place tablespaces arrived and caused this problem (ie directories where previously only symlinks were expected). Reviewed-by: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/CA%2BhUKGLzLK4PUPx0_AwXEWXOYAejU%3D7XpxnYE55Y%2Be7hB2N3FA%40mail.gmail.com
1 parent 6d306ab commit 202b56b

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/backend/access/transam/xlog.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8294,13 +8294,8 @@ do_pg_backup_start(const char *backupidstr, bool fast, TimeLineID *starttli_p,
82948294
* we sometimes use allow_in_place_tablespaces to create
82958295
* directories directly under pg_tblspc, which would fail below.
82968296
*/
8297-
#ifdef WIN32
8298-
if (!pgwin32_is_junction(fullpath))
8299-
continue;
8300-
#else
83018297
if (get_dirent_type(fullpath, de, false, ERROR) != PGFILETYPE_LNK)
83028298
continue;
8303-
#endif
83048299

83058300
#if defined(HAVE_READLINK) || defined(WIN32)
83068301
rllen = readlink(fullpath, linkpath, sizeof(linkpath));

src/bin/pg_basebackup/t/010_pg_basebackup.pl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,4 +904,21 @@
904904
'background process exit message');
905905
$sigchld_bb->finish();
906906

907+
# Test that we can back up an in-place tablespace
908+
$node->safe_psql('postgres',
909+
"SET allow_in_place_tablespaces = on; CREATE TABLESPACE tblspc2 LOCATION '';");
910+
$node->safe_psql('postgres',
911+
"CREATE TABLE test2 (a int) TABLESPACE tblspc2;"
912+
. "INSERT INTO test2 VALUES (1234);");
913+
my $tblspc_oid = $node->safe_psql('postgres',
914+
"SELECT oid FROM pg_tablespace WHERE spcname = 'tblspc2';");
915+
$node->backup('backup3');
916+
$node->safe_psql('postgres', "DROP TABLE test2;");
917+
$node->safe_psql('postgres', "DROP TABLESPACE tblspc2;");
918+
919+
# check that the in-place tablespace exists in the backup
920+
$backupdir = $node->backup_dir . '/backup3';
921+
my @dst_tblspc = glob "$backupdir/pg_tblspc/$tblspc_oid/PG_*";
922+
is(@dst_tblspc, 1, 'tblspc directory copied');
923+
907924
done_testing();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy