1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-03 00:26:59 +02:00

Allow stanza-* commands to be run remotely.

The stanza-create, stanza-upgrade and stanza-delete were required to be run on the repository host. When there was only one repository allowed this was not a problem.

However, with the introduction of multiple repository support, this becomes more of a burden to the user, therefore the stanza-create, stanza-upgrade and stanza-delete commands have been improved to allow for them to be run remotely.
This commit is contained in:
Cynthia Shang
2021-03-10 08:10:46 -05:00
committed by GitHub
parent c4a3dc4e46
commit 31c7824a4d
16 changed files with 215 additions and 132 deletions

View File

@ -90,13 +90,13 @@ sub run
$oHostBackup->stanzaUpgrade('fail on stanza not initialized since archive.info is missing',
{iExpectedExitStatus => ERROR_FILE_MISSING, strOptionalParam => '--no-online'});
# Create the stanza successfully without force
# Create the stanza successfully without force - run from the db server to ensure ability to run remotely
#--------------------------------------------------------------------------------------------------------------------------
$oHostBackup->stanzaCreate('successfully create the stanza', {strOptionalParam => '--no-online'});
$oHostDbPrimary->stanzaCreate('successfully create the stanza', {strOptionalParam => '--no-online'});
# Rerun stanza-create and confirm it does not fail
#--------------------------------------------------------------------------------------------------------------------------
$oHostBackup->stanzaCreate(
$oHostDbPrimary->stanzaCreate(
'do not fail on rerun of stanza-create - info files exist and DB section ok',
{strOptionalParam => '--no-online'});
@ -163,7 +163,7 @@ sub run
# Perform a successful stanza upgrade noting additional history lines in info files for new version of the database
#--------------------------------------------------------------------------------------------------------------------------
# Save a pre-upgrade copy of archive info fo testing db-id mismatch
# Save a pre-upgrade copy of archive info for testing db-id mismatch
forceStorageMove(storageRepo(), $strArchiveInfoCopyFile, $strArchiveInfoCopyOldFile, {bRecurse => false});
$oHostBackup->stanzaUpgrade('successful upgrade creates additional history', {strOptionalParam => '--no-online'});
@ -204,7 +204,8 @@ sub run
$self->controlGenerate($oHostDbPrimary->dbBasePath(), PG_VERSION_95);
forceStorageMode(storageTest(), $oHostDbPrimary->dbBasePath() . '/' . DB_FILE_PGCONTROL, '600');
$oHostBackup->stanzaUpgrade('successfully upgrade', {strOptionalParam => '--no-online'});
# Run from the db server to ensure ability to run remotely
$oHostDbPrimary->stanzaUpgrade('successfully upgrade', {strOptionalParam => '--no-online'});
# Copy archive.info and restore really old version
forceStorageMove(storageRepo(), $strArchiveInfoFile, $strArchiveInfoOldFile, {bRecurse => false});
@ -237,10 +238,10 @@ sub run
# Delete the stanza
#--------------------------------------------------------------------------------------------------------------------------
$oHostBackup->stanzaDelete('fail on missing stop file', {iExpectedExitStatus => ERROR_FILE_MISSING});
$oHostDbPrimary->stanzaDelete('fail on missing stop file', {iExpectedExitStatus => ERROR_FILE_MISSING});
$oHostBackup->stop({strStanza => $self->stanza()});
$oHostBackup->stanzaDelete('successfully delete the stanza');
$oHostDbPrimary->stop({strStanza => $self->stanza()});
$oHostDbPrimary->stanzaDelete('successfully delete the stanza');
}
}