diff --git a/build/lib/pgBackRestBuild/Config/Data.pm b/build/lib/pgBackRestBuild/Config/Data.pm index ad6010b77..fd08afb71 100644 --- a/build/lib/pgBackRestBuild/Config/Data.pm +++ b/build/lib/pgBackRestBuild/Config/Data.pm @@ -1400,6 +1400,10 @@ my %hConfigDefine = { &CFGCMD_ARCHIVE_GET => {}, &CFGCMD_ARCHIVE_PUSH => {}, + &CFGCMD_BACKUP => + { + &CFGDEF_INTERNAL => true, + }, &CFGCMD_CHECK => {}, &CFGCMD_INFO => {}, &CFGCMD_LOCAL => {}, @@ -1715,6 +1719,10 @@ my %hConfigDefine = &CFGCMD_CHECK => {}, &CFGCMD_EXPIRE => {}, &CFGCMD_LOCAL => {}, + &CFGCMD_RESTORE => + { + &CFGDEF_INTERNAL => true, + }, &CFGCMD_STANZA_CREATE => {}, &CFGCMD_STANZA_UPGRADE => {}, &CFGCMD_START => {}, diff --git a/doc/xml/release.xml b/doc/xml/release.xml index a3f640adc..aafd006b5 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -12,6 +12,16 @@ + + + + + + +

Fixed an issue that suppressed locality errors for backup and restore. When a backup host is present, backups should only be allowed on the backup host and restores should only be allowed on the database host unless an alternate configuration is created that ignores the remote host.

+
+
+

The C library is now required. This eliminates conditional loading and eases development of new library features.

diff --git a/lib/pgBackRest/Config/Config.pm b/lib/pgBackRest/Config/Config.pm index b3608d344..b95f4bdb2 100644 --- a/lib/pgBackRest/Config/Config.pm +++ b/lib/pgBackRest/Config/Config.pm @@ -218,7 +218,8 @@ sub configLoad confess &log(ERROR, "'" . cfgOption(CFGOPT_PROTOCOL_TIMEOUT) . "' is not valid for '" . cfgOptionName(CFGOPT_PROTOCOL_TIMEOUT) . "' option\n" . - "HINT: 'protocol-timeout' option should be greater than 'db-timeout' option.", + "HINT: 'protocol-timeout' option (" . cfgOption(CFGOPT_PROTOCOL_TIMEOUT) . + ") should be greater than 'db-timeout' option (" . cfgOption(CFGOPT_DB_TIMEOUT) . ").", ERROR_OPTION_INVALID_VALUE); } } diff --git a/src/config/define.auto.c b/src/config/define.auto.c index 309a6ed7e..e2ad9b3c7 100644 --- a/src/config/define.auto.c +++ b/src/config/define.auto.c @@ -237,6 +237,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST ( CFGDEFDATA_OPTION_COMMAND(cfgDefCmdArchiveGet) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdArchivePush) + CFGDEFDATA_OPTION_COMMAND(cfgDefCmdBackup) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdCheck) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdInfo) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdLocal) @@ -269,6 +270,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST ( CFGDEFDATA_OPTION_COMMAND(cfgDefCmdArchiveGet) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdArchivePush) + CFGDEFDATA_OPTION_COMMAND(cfgDefCmdBackup) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdCheck) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdInfo) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdLocal) @@ -302,6 +304,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST ( CFGDEFDATA_OPTION_COMMAND(cfgDefCmdArchiveGet) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdArchivePush) + CFGDEFDATA_OPTION_COMMAND(cfgDefCmdBackup) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdCheck) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdInfo) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdLocal) @@ -329,6 +332,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST ( CFGDEFDATA_OPTION_COMMAND(cfgDefCmdArchiveGet) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdArchivePush) + CFGDEFDATA_OPTION_COMMAND(cfgDefCmdBackup) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdCheck) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdInfo) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdLocal) @@ -387,6 +391,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST ( CFGDEFDATA_OPTION_COMMAND(cfgDefCmdArchiveGet) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdArchivePush) + CFGDEFDATA_OPTION_COMMAND(cfgDefCmdBackup) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdCheck) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdInfo) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdLocal) @@ -732,6 +737,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_COMMAND(cfgDefCmdCheck) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdExpire) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdLocal) + CFGDEFDATA_OPTION_COMMAND(cfgDefCmdRestore) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdStanzaCreate) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdStanzaUpgrade) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdStart) @@ -896,6 +902,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_COMMAND(cfgDefCmdCheck) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdExpire) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdLocal) + CFGDEFDATA_OPTION_COMMAND(cfgDefCmdRestore) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdStanzaCreate) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdStanzaUpgrade) CFGDEFDATA_OPTION_COMMAND(cfgDefCmdStart) diff --git a/test/expect/mock-all-002.log b/test/expect/mock-all-002.log index 5f0f69182..9983d5d0c 100644 --- a/test/expect/mock-all-002.log +++ b/test/expect/mock-all-002.log @@ -1532,6 +1532,18 @@ P00 INFO: restore command end: completed successfully ---------------------------------------------------------------- restore_command = '[BACKREST-BIN] --compress-level-network=0 --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=detail --stanza=db archive-get %f "%p"' +restore, backup '[BACKUP-FULL-2]', expect exit 72 - restore errors on backup host (backup host) +> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --set=[BACKUP-FULL-2] --log-level-console=warn --stanza=db restore +------------------------------------------------------------------------------------------------------------------------------------ +P00 ERROR: [072]: restore command must be run on the db host + +full backup - backup errors on db host (db-master host) +> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --log-level-console=warn --type=full --stanza=db backup +------------------------------------------------------------------------------------------------------------------------------------ +P00 WARN: option retention-full is not set, the repository may run out of space + HINT: to retain full backups indefinitely (without warning), set option 'retention-full' to the maximum. +P00 ERROR: [072]: backup and expire commands must be run on the backup host + restore delta, force, backup '[BACKUP-FULL-2]', expect exit 40 - fail on missing PG_VERSION (db-master host) > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --delta --force --set=[BACKUP-FULL-2] --log-level-console=detail --stanza=db restore ------------------------------------------------------------------------------------------------------------------------------------ diff --git a/test/lib/pgBackRestTest/Module/Config/ConfigOptionTest.pm b/test/lib/pgBackRestTest/Module/Config/ConfigOptionTest.pm index 8465279d8..3f2487d48 100644 --- a/test/lib/pgBackRestTest/Module/Config/ConfigOptionTest.pm +++ b/test/lib/pgBackRestTest/Module/Config/ConfigOptionTest.pm @@ -304,7 +304,7 @@ sub run $self->configTestLoadExpect( cfgCommandName(CFGCMD_BACKUP), ERROR_OPTION_INVALID_VALUE, 4, cfgOptionName(CFGOPT_PROTOCOL_TIMEOUT), - "'protocol-timeout' option should be greater than 'db-timeout' option"); + "'protocol-timeout' option (4) should be greater than 'db-timeout' option (5)"); } if ($self->begin(cfgCommandName(CFGCMD_RESTORE) . ' invalid value ' . cfgOptionName(CFGOPT_RECOVERY_OPTION))) diff --git a/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm b/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm index fbe526602..2ab469e97 100644 --- a/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm +++ b/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm @@ -575,6 +575,20 @@ sub run {rhExpectedManifest => \%oManifest, bDelta => true, strOptionalParam => " --link-all ${strLogReduced}" . ($bRemote ? ' --compress-level-network=0' : '')}); + # Test operations not running on their usual host + if ($bRemote && !$bS3) + { + $oHostBackup->restore( + 'restore errors on backup host', $strFullBackup, + {rhExpectedManifest => \%oManifest, strUser => TEST_USER, iExpectedExitStatus => ERROR_HOST_INVALID, + strOptionalParam => "--log-level-console=warn"}); + + $oHostDbMaster->backup( + $strType, 'backup errors on db host', + {oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_HOST_INVALID, + strOptionalParam => "--log-level-console=warn"}); + } + # Additional restore tests that don't need to be performed for every permutation if (!$bRemote) {