You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-09-16 09:06:18 +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
@@ -46,6 +46,15 @@
|
||||
|
||||
<p>Fix issue where specifying <br-setting>log-level-stderr</br-setting> > <id>warn</id> would cause a <cmd>local</cmd>/<cmd>remote</cmd> process to error on exit due to output found on stderr when none was expected. The max value for a <cmd>local</cmd>/<cmd>remote</cmd> process is now error since there's no reason for these processes to emit warnings.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<release-item-contributor-list>
|
||||
<release-item-ideator id="flatley.thomas"/>
|
||||
<release-item-contributor id="shang.cynthia"/>
|
||||
</release-item-contributor-list>
|
||||
|
||||
<p>Fix manifest test in the <cmd>check</cmd> command when tablespaces are present.</p>
|
||||
</release-item>
|
||||
</release-bug-list>
|
||||
|
||||
<release-improvement-list>
|
||||
@@ -4234,6 +4243,11 @@
|
||||
<contributor-id type="github">keithf4</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="flatley.thomas">
|
||||
<contributor-name-display>Thomas Flatley</contributor-name-display>
|
||||
<contributor-id type="github">seadba</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="fort.chris">
|
||||
<contributor-name-display>Chris Fort</contributor-name-display>
|
||||
<contributor-id type="github">the1forte</contributor-id>
|
||||
|
@@ -16,6 +16,7 @@ use pgBackRest::Common::Log;
|
||||
use pgBackRest::Common::Wait;
|
||||
use pgBackRest::Config::Config;
|
||||
use pgBackRest::Db;
|
||||
use pgBackRest::Manifest;
|
||||
use pgBackRest::Protocol::Helper;
|
||||
use pgBackRest::Protocol::Storage::Helper;
|
||||
|
||||
@@ -90,8 +91,15 @@ sub process
|
||||
strCipherPass => 'x',
|
||||
strCipherPassSub => 'x'});
|
||||
|
||||
# Set required settings not set during manifest instantiation
|
||||
$oBackupManifest->numericSet(MANIFEST_SECTION_BACKUP_DB, MANIFEST_KEY_DB_ID, undef, 1);
|
||||
$oBackupManifest->numericSet(MANIFEST_SECTION_BACKUP_DB, MANIFEST_KEY_CONTROL, undef, $iControlVersion);
|
||||
$oBackupManifest->numericSet(MANIFEST_SECTION_BACKUP_DB, MANIFEST_KEY_CATALOG, undef, $iCatalogVersion);
|
||||
$oBackupManifest->numericSet(MANIFEST_SECTION_BACKUP_DB, MANIFEST_KEY_SYSTEM_ID, undef, $ullDbSysId);
|
||||
|
||||
$oBackupManifest->build(storageDb({iRemoteIdx => $iRemoteIdx}),
|
||||
cfgOption(cfgOptionIdFromIndex(CFGOPT_PG_PATH, $iRemoteIdx)), undef, cfgOption(CFGOPT_ONLINE));
|
||||
cfgOption(cfgOptionIdFromIndex(CFGOPT_PG_PATH, $iRemoteIdx)), undef, cfgOption(CFGOPT_ONLINE),
|
||||
$oDb->tablespaceMapGet());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -154,6 +154,10 @@ spool-path=[TEST_PATH]/db-master/spool
|
||||
archive-copy=y
|
||||
start-fast=y
|
||||
|
||||
check db - check command with tablespace (db-master host)
|
||||
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=detail --archive-timeout=5 --stanza=db check
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
restore, type 'default', expect exit 38 - postmaster running (db-master host)
|
||||
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --link-all --stanza=db restore
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@@ -220,6 +220,10 @@ repo1-path=[TEST_PATH]/backup/repo
|
||||
archive-copy=y
|
||||
start-fast=y
|
||||
|
||||
check db - check command with tablespace (backup host)
|
||||
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --log-level-console=detail --archive-timeout=5 --stanza=db check
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
restore, type 'default' (db-master host)
|
||||
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --buffer-size=16384 --link-all --stanza=db restore
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@@ -226,6 +226,10 @@ repo1-type=s3
|
||||
archive-copy=y
|
||||
start-fast=y
|
||||
|
||||
check db - check command with tablespace (backup host)
|
||||
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --log-level-console=detail --archive-timeout=5 --stanza=db check
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
restore, type 'default' (db-master host)
|
||||
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --buffer-size=16384 --link-all --stanza=db restore
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@@ -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