diff options
author | Robert Haas <rhaas@postgresql.org> | 2024-04-17 15:56:33 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2024-04-19 13:08:03 -0400 |
commit | 6bf5c42b5546984df29289918f952e6211069c54 (patch) | |
tree | 1314b11ac2e6395aa4ee80fdcc97424b26ebd166 /src/bin | |
parent | 41d2c6f952edc4841763d05296b65f3c0edad4f2 (diff) | |
download | postgresql-6bf5c42b5546984df29289918f952e6211069c54.tar.gz postgresql-6bf5c42b5546984df29289918f952e6211069c54.zip |
Make PostgreSQL::Test::Cluster::init_from_backup handle tablespaces.
This commit doesn't use this infrastructure for anything new, although
it does adapt 010_pg_basebackup.pl to use it. However, a future commit
will use this to improve test coverage for pg_combinebackup.
Patch by me, reviewed (but not fully endorsed) by Andres Freund.
Discussion: http://postgr.es/m/CA+TgmoYdXTjo9iQeoipTccDpWZzvBNS6EndY2uARM+T4yG_yDg@mail.gmail.com
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/pg_basebackup/t/010_pg_basebackup.pl | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl index 63f7bd2735a..31c369688e0 100644 --- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl +++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl @@ -407,25 +407,12 @@ SKIP: my $node2 = PostgreSQL::Test::Cluster->new('replica'); - # Recover main data directory - $node2->init_from_backup($node, 'tarbackup2', tar_program => $tar); - - # Recover tablespace into a new directory (not where it was!) - my $repTsDir = "$tempdir/tblspc1replica"; - my $realRepTsDir = "$real_sys_tempdir/tblspc1replica"; - mkdir $repTsDir; - PostgreSQL::Test::Utils::system_or_bail($tar, 'xf', $tblspc_tars[0], - '-C', $repTsDir); - - # Update tablespace map to point to new directory. - # XXX Ideally pg_basebackup would handle this. + # Recover the backup $tblspc_tars[0] =~ m|/([0-9]*)\.tar$|; my $tblspcoid = $1; - my $escapedRepTsDir = $realRepTsDir; - $escapedRepTsDir =~ s/\\/\\\\/g; - open my $mapfile, '>', $node2->data_dir . '/tablespace_map' or die $!; - print $mapfile "$tblspcoid $escapedRepTsDir\n"; - close $mapfile; + my $realRepTsDir = "$real_sys_tempdir/tblspc1replica"; + $node2->init_from_backup($node, 'tarbackup2', tar_program => $tar, + 'tablespace_map' => { $tblspcoid => $realRepTsDir }); $node2->start; my $result = $node2->safe_psql('postgres', 'SELECT * FROM test1'); |