mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-03-03 14:52:21 +02:00
Fixed some issues with remote backups after restore (unit test bugs only).
This commit is contained in:
parent
21c715b25c
commit
a3b3f98f66
@ -790,6 +790,7 @@ sub BackRestTestBackup_Restore
|
|||||||
my $oFile = shift;
|
my $oFile = shift;
|
||||||
my $strBackup = shift;
|
my $strBackup = shift;
|
||||||
my $strStanza = shift;
|
my $strStanza = shift;
|
||||||
|
my $bRemote = shift;
|
||||||
my $oExpectedManifestRef = shift;
|
my $oExpectedManifestRef = shift;
|
||||||
my $oRemapHashRef = shift;
|
my $oRemapHashRef = shift;
|
||||||
my $bDelta = shift;
|
my $bDelta = shift;
|
||||||
@ -800,15 +801,15 @@ sub BackRestTestBackup_Restore
|
|||||||
$bDelta = defined($bDelta) ? $bDelta : false;
|
$bDelta = defined($bDelta) ? $bDelta : false;
|
||||||
$bForce = defined($bForce) ? $bForce : false;
|
$bForce = defined($bForce) ? $bForce : false;
|
||||||
|
|
||||||
if (defined($oRemapHashRef))
|
|
||||||
{
|
|
||||||
BackRestTestCommon_ConfigRemap($oRemapHashRef, $oExpectedManifestRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
&log(INFO, ' ' . ($bDelta ? 'delta ' : '') . ($bForce ? 'force ' : '') .
|
&log(INFO, ' ' . ($bDelta ? 'delta ' : '') . ($bForce ? 'force ' : '') .
|
||||||
(defined($oRemapHashRef) ? 'remap ' : '') . 'restore' .
|
(defined($oRemapHashRef) ? 'remap ' : '') . 'restore' .
|
||||||
(defined($strComment) ? " (${strComment})" : ''));
|
(defined($strComment) ? " (${strComment})" : ''));
|
||||||
|
|
||||||
|
if (defined($oRemapHashRef))
|
||||||
|
{
|
||||||
|
BackRestTestCommon_ConfigRemap($oRemapHashRef, $oExpectedManifestRef, $bRemote);
|
||||||
|
}
|
||||||
|
|
||||||
# Create the backup command
|
# Create the backup command
|
||||||
BackRestTestCommon_Execute(BackRestTestCommon_CommandMainGet() . ' --config=' . BackRestTestCommon_DbPathGet() .
|
BackRestTestCommon_Execute(BackRestTestCommon_CommandMainGet() . ' --config=' . BackRestTestCommon_DbPathGet() .
|
||||||
'/pg_backrest.conf' . (defined($bDelta) && $bDelta ? ' --delta' : '') .
|
'/pg_backrest.conf' . (defined($bDelta) && $bDelta ? ' --delta' : '') .
|
||||||
@ -1249,7 +1250,7 @@ sub BackRestTestBackup_Test
|
|||||||
|
|
||||||
# Remove a file
|
# Remove a file
|
||||||
BackRestTestBackup_FileRemove(\%oManifest, 'base', 'PG_VERSION');
|
BackRestTestBackup_FileRemove(\%oManifest, 'base', 'PG_VERSION');
|
||||||
BackRestTestBackup_Restore($oFile, $strFullBackup, $strStanza, \%oManifest, undef, $bDelta, $bForce,
|
BackRestTestBackup_Restore($oFile, $strFullBackup, $strStanza, $bRemote, \%oManifest, undef, $bDelta, $bForce,
|
||||||
'add and delete files');
|
'add and delete files');
|
||||||
|
|
||||||
# Incr backup - add a tablespace
|
# Incr backup - add a tablespace
|
||||||
@ -1299,9 +1300,9 @@ sub BackRestTestBackup_Test
|
|||||||
# Remap the base path
|
# Remap the base path
|
||||||
my %oRemapHash;
|
my %oRemapHash;
|
||||||
$oRemapHash{base} = BackRestTestCommon_DbCommonPathGet(2);
|
$oRemapHash{base} = BackRestTestCommon_DbCommonPathGet(2);
|
||||||
# $oRemapHash{1} = BackRestTestCommon_DbTablespacePathGet(1, 2);
|
$oRemapHash{1} = BackRestTestCommon_DbTablespacePathGet(1, 2);
|
||||||
|
|
||||||
BackRestTestBackup_Restore($oFile, $strFullBackup, $strStanza, \%oManifest, \%oRemapHash, $bDelta, $bForce,
|
BackRestTestBackup_Restore($oFile, $strFullBackup, $strStanza, $bRemote, \%oManifest, \%oRemapHash, $bDelta, $bForce,
|
||||||
'remap base path');
|
'remap base path');
|
||||||
|
|
||||||
# Incr Backup
|
# Incr Backup
|
||||||
|
@ -418,6 +418,7 @@ sub BackRestTestCommon_ConfigRemap
|
|||||||
{
|
{
|
||||||
my $oRemapHashRef = shift;
|
my $oRemapHashRef = shift;
|
||||||
my $oManifestRef = shift;
|
my $oManifestRef = shift;
|
||||||
|
my $bRemote = shift;
|
||||||
|
|
||||||
# Create config filename
|
# Create config filename
|
||||||
my $strConfigFile = BackRestTestCommon_DbPathGet() . '/pg_backrest.conf';
|
my $strConfigFile = BackRestTestCommon_DbPathGet() . '/pg_backrest.conf';
|
||||||
@ -427,6 +428,16 @@ sub BackRestTestCommon_ConfigRemap
|
|||||||
my %oConfig;
|
my %oConfig;
|
||||||
ini_load($strConfigFile, \%oConfig);
|
ini_load($strConfigFile, \%oConfig);
|
||||||
|
|
||||||
|
# Load remote config file
|
||||||
|
my %oRemoteConfig;
|
||||||
|
my $strRemoteConfigFile = BackRestTestCommon_TestPathGet() . '/pg_backrest.conf.remote';
|
||||||
|
|
||||||
|
if ($bRemote)
|
||||||
|
{
|
||||||
|
BackRestTestCommon_Execute("mv " . BackRestTestCommon_BackupPathGet() . "/pg_backrest.conf ${strRemoteConfigFile}", true);
|
||||||
|
ini_load($strRemoteConfigFile, \%oRemoteConfig);
|
||||||
|
}
|
||||||
|
|
||||||
# Rewrite remap section
|
# Rewrite remap section
|
||||||
delete($oConfig{"${strStanza}:tablespace:map"});
|
delete($oConfig{"${strStanza}:tablespace:map"});
|
||||||
|
|
||||||
@ -438,6 +449,11 @@ sub BackRestTestCommon_ConfigRemap
|
|||||||
{
|
{
|
||||||
$oConfig{$strStanza}{path} = $strRemapPath;
|
$oConfig{$strStanza}{path} = $strRemapPath;
|
||||||
${$oManifestRef}{'backup:path'}{base} = $strRemapPath;
|
${$oManifestRef}{'backup:path'}{base} = $strRemapPath;
|
||||||
|
|
||||||
|
if ($bRemote)
|
||||||
|
{
|
||||||
|
$oRemoteConfig{$strStanza}{path} = $strRemapPath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -451,6 +467,13 @@ sub BackRestTestCommon_ConfigRemap
|
|||||||
|
|
||||||
# Resave the config file
|
# Resave the config file
|
||||||
ini_save($strConfigFile, \%oConfig);
|
ini_save($strConfigFile, \%oConfig);
|
||||||
|
|
||||||
|
# Load remote config file
|
||||||
|
if ($bRemote)
|
||||||
|
{
|
||||||
|
ini_save($strRemoteConfigFile, \%oRemoteConfig);
|
||||||
|
BackRestTestCommon_Execute("mv ${strRemoteConfigFile} " . BackRestTestCommon_BackupPathGet() . '/pg_backrest.conf', true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
####################################################################################################################################
|
####################################################################################################################################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user