You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-12-01 22:30:09 +02:00
Fix manifest test in the check command when tablespaces are present.
Fixed by Cynthia Shang. Reported by Thomas Flatley.
This commit is contained in:
committed by
David Steele
parent
8e9e97728c
commit
f0a4264f77
@@ -128,6 +128,9 @@ sub new
|
||||
# Default hardlink to false
|
||||
$self->{bHardLink} = false;
|
||||
|
||||
# By default there is no bogus host
|
||||
$self->{bBogusHost} = false;
|
||||
|
||||
# Create a placeholder hash for file munging
|
||||
$self->{hInfoFile} = {};
|
||||
|
||||
@@ -1117,6 +1120,9 @@ sub configCreate
|
||||
$oParamHash{$strStanza}{cfgOptionName(cfgOptionIdFromIndex(CFGOPT_PG_PATH, $iInvalidReplica))} =
|
||||
$oHostDb2->dbBasePath();
|
||||
|
||||
# Set a flag so we know there's a bogus host
|
||||
$self->{bBogusHost} = true;
|
||||
|
||||
# Set a valid replica to the last possible index to ensure skipping indexes does not make a difference.
|
||||
my $iValidReplica = cfgOptionIndexTotal(CFGOPT_PG_PATH);
|
||||
$oParamHash{$strStanza}{cfgOptionName(cfgOptionIdFromIndex(CFGOPT_PG_HOST, $iValidReplica))} = $oHostDb2->nameGet();
|
||||
@@ -2008,6 +2014,7 @@ sub restoreCompare
|
||||
sub backrestConfig {return shift->{strBackRestConfig}}
|
||||
sub backupDestination {return shift->{strBackupDestination}}
|
||||
sub backrestExe {return testRunGet()->backrestExe()}
|
||||
sub bogusHost {return shift->{bBogusHost}}
|
||||
sub hardLink {return shift->{bHardLink}}
|
||||
sub hasLink {storageRepo()->driver()->className() eq STORAGE_POSIX_DRIVER}
|
||||
sub isFS {storageRepo()->driver()->className() ne STORAGE_S3_DRIVER}
|
||||
|
||||
@@ -499,25 +499,11 @@ sub run
|
||||
executeTest("sudo chown root:root ${strDir}");
|
||||
executeTest("sudo chmod 400 ${strDir}");
|
||||
|
||||
# Determine if there is an invalid pg-host from the config file
|
||||
my $rhConfig = iniParse(${storageTest()->get($oHostDbStandby->backrestConfig())}, {bRelaxed => true});
|
||||
my $bBogusHost = false;
|
||||
|
||||
for (my $iRemoteIdx = 1; $iRemoteIdx <= cfgOptionIndexTotal(CFGOPT_PG_HOST); $iRemoteIdx++)
|
||||
{
|
||||
if (defined($rhConfig->{$self->stanza()}{cfgOptionName(cfgOptionIdFromIndex(CFGOPT_PG_HOST, $iRemoteIdx))}) &&
|
||||
($rhConfig->{$self->stanza()}{cfgOptionName(cfgOptionIdFromIndex(CFGOPT_PG_HOST, $iRemoteIdx))} eq BOGUS))
|
||||
{
|
||||
$bBogusHost = true;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
my $strComment = 'confirm standby manifest->build executed';
|
||||
|
||||
# If there is an invalid host, the final error returned from check will be the inability to resolve the name which is
|
||||
# a read error instead of an open error
|
||||
if (!$bBogusHost)
|
||||
if (!$oHostDbStandby->bogusHost())
|
||||
{
|
||||
$oHostDbStandby->check($strComment, {iTimeout => 5, iExpectedExitStatus => ERROR_FILE_OPEN});
|
||||
}
|
||||
@@ -530,7 +516,7 @@ sub run
|
||||
executeTest("sudo rmdir ${strDir}");
|
||||
|
||||
# Confirm the check command runs without error on a standby (when a bogus host is not configured)
|
||||
if (!$bBogusHost)
|
||||
if (!$oHostDbStandby->bogusHost())
|
||||
{
|
||||
$oHostDbStandby->check('verify check command on standby');
|
||||
}
|
||||
@@ -660,6 +646,12 @@ sub run
|
||||
|
||||
my $strIncrBackup = $oHostBackup->backupEnd(CFGOPTVAL_BACKUP_TYPE_INCR, $oExecuteBackup);
|
||||
|
||||
# Ensure the check command runs properly with a tablespace unless there is a bogus host
|
||||
if (!$oHostBackup->bogusHost())
|
||||
{
|
||||
$oHostBackup->check( 'check command with tablespace', {iTimeout => 5});
|
||||
}
|
||||
|
||||
# Setup the xid target
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
my $strXidTarget = undef;
|
||||
|
||||
Reference in New Issue
Block a user