pgbackrest.git / summary / log / commit / refs

commit    8dfe0e48e25725978738ecb3fec24e5ce2e9076b
Author:   David Steele <david@crunchydata.com>
Date:     Mon Dec 02 15:49:25 2019 +0000

    Use more general error code when tablespace linked into PGDATA.
    
    The specific error code was not that useful since we also test the error message which contains details of the link error.


build/error.yaml | 1 - lib/pgBackRest/Common/ExceptionAuto.pm | 2 -- lib/pgBackRest/Manifest.pm | 2 +- src/common/error.auto.c | 2 -- src/common/error.auto.h | 1 - src/perl/embed.auto.c | 4 +--- test/expect/mock-all-001.log | 24 +++++++++++----------- test/expect/mock-all-002.log | 4 ++-- .../Module/Manifest/ManifestAllPerlTest.pm | 8 ++++---- test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm | 12 +++++------ 10 files changed, 26 insertions(+), 34 deletions(-) diff --git a/build/error.yaml b/build/error.yaml index 0d19b6f9a..2ba8899a7 100644 --- a/build/error.yaml +++ b/build/error.yaml @@ -50,7 +50,6 @@ feature-not-supported: 67 archive-command-invalid: 68 link-expected: 69 link-destination: 70 -tablespace-in-pgdata: 71 host-invalid: 72 path-missing: 73 file-move: 74 diff --git a/lib/pgBackRest/Common/ExceptionAuto.pm b/lib/pgBackRest/Common/ExceptionAuto.pm index d253d06ad..73e30b981 100644 --- a/lib/pgBackRest/Common/ExceptionAuto.pm +++ b/lib/pgBackRest/Common/ExceptionAuto.pm @@ -109,8 +109,6 @@ use constant ERROR_LINK_EXPECTED => 69; push @EXPORT, qw(ERROR_LINK_EXPECTED); use constant ERROR_LINK_DESTINATION => 70; push @EXPORT, qw(ERROR_LINK_DESTINATION); -use constant ERROR_TABLESPACE_IN_PGDATA => 71; -push @EXPORT, qw(ERROR_TABLESPACE_IN_PGDATA); use constant ERROR_HOST_INVALID => 72; push @EXPORT, qw(ERROR_HOST_INVALID); use constant ERROR_PATH_MISSING => 73; diff --git a/lib/pgBackRest/Manifest.pm b/lib/pgBackRest/Manifest.pm index 73b55ce79..b9b6f5c54 100644 --- a/lib/pgBackRest/Manifest.pm +++ b/lib/pgBackRest/Manifest.pm @@ -1028,7 +1028,7 @@ sub build $hManifest->{$strName}{link_destination}) . '/', "${strPath}/") == 0)) { confess &log(ERROR, 'tablespace symlink ' . $hManifest->{$strName}{link_destination} . - ' destination must not be in $PGDATA', ERROR_TABLESPACE_IN_PGDATA); + ' destination must not be in $PGDATA', ERROR_LINK_DESTINATION); } } diff --git a/src/common/error.auto.c b/src/common/error.auto.c index 8a31ada52..490d075e3 100644 --- a/src/common/error.auto.c +++ b/src/common/error.auto.c @@ -52,7 +52,6 @@ ERROR_DEFINE( 67, FeatureNotSupportedError, RuntimeError); ERROR_DEFINE( 68, ArchiveCommandInvalidError, RuntimeError); ERROR_DEFINE( 69, LinkExpectedError, RuntimeError); ERROR_DEFINE( 70, LinkDestinationError, RuntimeError); -ERROR_DEFINE( 71, TablespaceInPgdataError, RuntimeError); ERROR_DEFINE( 72, HostInvalidError, RuntimeError); ERROR_DEFINE( 73, PathMissingError, RuntimeError); ERROR_DEFINE( 74, FileMoveError, RuntimeError); @@ -139,7 +138,6 @@ static const ErrorType *errorTypeList[] = &ArchiveCommandInvalidError, &LinkExpectedError, &LinkDestinationError, - &TablespaceInPgdataError, &HostInvalidError, &PathMissingError, &FileMoveError, diff --git a/src/common/error.auto.h b/src/common/error.auto.h index 2aed703bc..e95762bab 100644 --- a/src/common/error.auto.h +++ b/src/common/error.auto.h @@ -54,7 +54,6 @@ ERROR_DECLARE(FeatureNotSupportedError); ERROR_DECLARE(ArchiveCommandInvalidError); ERROR_DECLARE(LinkExpectedError); ERROR_DECLARE(LinkDestinationError); -ERROR_DECLARE(TablespaceInPgdataError); ERROR_DECLARE(HostInvalidError); ERROR_DECLARE(PathMissingError); ERROR_DECLARE(FileMoveError); diff --git a/src/perl/embed.auto.c b/src/perl/embed.auto.c index bd63f5837..23d9239ec 100644 --- a/src/perl/embed.auto.c +++ b/src/perl/embed.auto.c @@ -3363,8 +3363,6 @@ static const EmbeddedModule embeddedModule[] = "push @EXPORT, qw(ERROR_LINK_EXPECTED);\n" "use constant ERROR_LINK_DESTINATION => 70;\n" "push @EXPORT, qw(ERROR_LINK_DESTINATION);\n" - "use constant ERROR_TABLESPACE_IN_PGDATA => 71;\n" - "push @EXPORT, qw(ERROR_TABLESPACE_IN_PGDATA);\n" "use constant ERROR_HOST_INVALID => 72;\n" "push @EXPORT, qw(ERROR_HOST_INVALID);\n" "use constant ERROR_PATH_MISSING => 73;\n" @@ -8939,7 +8937,7 @@ static const EmbeddedModule embeddedModule[] = "$hManifest->{$strName}{link_destination}) . '/', \"${strPath}/\") == 0))\n" "{\n" "confess &log(ERROR, 'tablespace symlink ' . $hManifest->{$strName}{link_destination} .\n" - "' destination must not be in $PGDATA', ERROR_TABLESPACE_IN_PGDATA);\n" + "' destination must not be in $PGDATA', ERROR_LINK_DESTINATION);\n" "}\n" "}\n" "\n\n" diff --git a/test/expect/mock-all-001.log b/test/expect/mock-all-001.log index 85d0223e5..549cf3f5e 100644 --- a/test/expect/mock-all-001.log +++ b/test/expect/mock-all-001.log @@ -1004,8 +1004,8 @@ P00 WARN: option repo1-retention-full is not set, the repository may run out o HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. P00 INFO: last backup label = [BACKUP-FULL-2], version = [VERSION-1] P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2] -P00 ERROR: [071]: tablespace symlink ../ destination must not be in $PGDATA -P00 INFO: backup command end: aborted with exception [071] +P00 ERROR: [070]: tablespace symlink ../ destination must not be in $PGDATA +P00 INFO: backup command end: aborted with exception [070] incr backup - invalid relative tablespace is .. (db-master host) > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --stanza=db backup @@ -1015,8 +1015,8 @@ P00 WARN: option repo1-retention-full is not set, the repository may run out o HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. P00 INFO: last backup label = [BACKUP-FULL-2], version = [VERSION-1] P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2] -P00 ERROR: [071]: tablespace symlink .. destination must not be in $PGDATA -P00 INFO: backup command end: aborted with exception [071] +P00 ERROR: [070]: tablespace symlink .. destination must not be in $PGDATA +P00 INFO: backup command end: aborted with exception [070] incr backup - invalid relative tablespace is ../../$PGDATA (db-master host) > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --stanza=db backup @@ -1026,8 +1026,8 @@ P00 WARN: option repo1-retention-full is not set, the repository may run out o HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. P00 INFO: last backup label = [BACKUP-FULL-2], version = [VERSION-1] P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2] -P00 ERROR: [071]: tablespace symlink ../../base/ destination must not be in $PGDATA -P00 INFO: backup command end: aborted with exception [071] +P00 ERROR: [070]: tablespace symlink ../../base/ destination must not be in $PGDATA +P00 INFO: backup command end: aborted with exception [070] incr backup - invalid relative tablespace is ../../$PGDATA (db-master host) > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --stanza=db backup @@ -1037,8 +1037,8 @@ P00 WARN: option repo1-retention-full is not set, the repository may run out o HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. P00 INFO: last backup label = [BACKUP-FULL-2], version = [VERSION-1] P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2] -P00 ERROR: [071]: tablespace symlink ../../base destination must not be in $PGDATA -P00 INFO: backup command end: aborted with exception [071] +P00 ERROR: [070]: tablespace symlink ../../base destination must not be in $PGDATA +P00 INFO: backup command end: aborted with exception [070] incr backup - tablespace link references a link (db-master host) > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --stanza=db backup @@ -1059,8 +1059,8 @@ P00 WARN: option repo1-retention-full is not set, the repository may run out o HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. P00 INFO: last backup label = [BACKUP-FULL-2], version = [VERSION-1] P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2] -P00 ERROR: [071]: tablespace symlink ../invalid_tblspc destination must not be in $PGDATA -P00 INFO: backup command end: aborted with exception [071] +P00 ERROR: [070]: tablespace symlink ../invalid_tblspc destination must not be in $PGDATA +P00 INFO: backup command end: aborted with exception [070] incr backup - $PGDATA is a substring of valid tblspc excluding / (file missing err expected) (db-master host) > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --stanza=db backup @@ -1081,8 +1081,8 @@ P00 WARN: option repo1-retention-full is not set, the repository may run out o HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. P00 INFO: last backup label = [BACKUP-FULL-2], version = [VERSION-1] P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2] -P00 ERROR: [071]: tablespace symlink [TEST_PATH]/db-master/db/base/invalid_tblspc destination must not be in $PGDATA -P00 INFO: backup command end: aborted with exception [071] +P00 ERROR: [070]: tablespace symlink [TEST_PATH]/db-master/db/base/invalid_tblspc destination must not be in $PGDATA +P00 INFO: backup command end: aborted with exception [070] incr backup - add tablespace 1 (db-master host) > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --test --stanza=db backup diff --git a/test/expect/mock-all-002.log b/test/expect/mock-all-002.log index 686a1ed4c..7866cc29c 100644 --- a/test/expect/mock-all-002.log +++ b/test/expect/mock-all-002.log @@ -529,7 +529,7 @@ incr backup - invalid relative tablespace in $PGDATA (backup host) P00 WARN: option repo1-retention-full is not set, the repository may run out of space HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2] -P00 ERROR: [071]: tablespace symlink ../invalid_tblspc destination must not be in $PGDATA +P00 ERROR: [070]: tablespace symlink ../invalid_tblspc destination must not be in $PGDATA incr backup - invalid tablespace in $PGDATA (backup host) > [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --stanza=db backup @@ -537,7 +537,7 @@ incr backup - invalid tablespace in $PGDATA (backup host) P00 WARN: option repo1-retention-full is not set, the repository may run out of space HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2] -P00 ERROR: [071]: tablespace symlink [TEST_PATH]/db-master/db/base/invalid_tblspc destination must not be in $PGDATA +P00 ERROR: [070]: tablespace symlink [TEST_PATH]/db-master/db/base/invalid_tblspc destination must not be in $PGDATA incr backup - add tablespace 1 (backup host) > [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --test --stanza=db backup diff --git a/test/lib/pgBackRestTest/Module/Manifest/ManifestAllPerlTest.pm b/test/lib/pgBackRestTest/Module/Manifest/ManifestAllPerlTest.pm index 4a5e9a6c0..595f92d41 100644 --- a/test/lib/pgBackRestTest/Module/Manifest/ManifestAllPerlTest.pm +++ b/test/lib/pgBackRestTest/Module/Manifest/ManifestAllPerlTest.pm @@ -764,7 +764,7 @@ sub run $oManifest = new pgBackRest::Manifest( $strBackupManifestFile, {bLoad => false, strDbVersion => PG_VERSION_94, iDbCatalogVersion => $self->dbCatalogVersion(PG_VERSION_94)}); - $self->testException(sub {$oManifest->build(storageDb(), $self->{strDbPath}, undef, true, false)}, ERROR_TABLESPACE_IN_PGDATA, + $self->testException(sub {$oManifest->build(storageDb(), $self->{strDbPath}, undef, true, false)}, ERROR_LINK_DESTINATION, 'tablespace symlink ../ destination must not be in $PGDATA'); testFileRemove("${strTblSpcPath}/${strTblspcId}"); @@ -773,7 +773,7 @@ sub run $oManifest = new pgBackRest::Manifest( $strBackupManifestFile, {bLoad => false, strDbVersion => PG_VERSION_94, iDbCatalogVersion => $self->dbCatalogVersion(PG_VERSION_94)}); - $self->testException(sub {$oManifest->build(storageDb(), $self->{strDbPath}, undef, true, false)}, ERROR_TABLESPACE_IN_PGDATA, + $self->testException(sub {$oManifest->build(storageDb(), $self->{strDbPath}, undef, true, false)}, ERROR_LINK_DESTINATION, 'tablespace symlink .. destination must not be in $PGDATA'); testFileRemove("${strTblSpcPath}/${strTblspcId}"); @@ -782,7 +782,7 @@ sub run $oManifest = new pgBackRest::Manifest( $strBackupManifestFile, {bLoad => false, strDbVersion => PG_VERSION_94, iDbCatalogVersion => $self->dbCatalogVersion(PG_VERSION_94)}); - $self->testException(sub {$oManifest->build(storageDb(), $self->{strDbPath}, undef, true, false)}, ERROR_TABLESPACE_IN_PGDATA, + $self->testException(sub {$oManifest->build(storageDb(), $self->{strDbPath}, undef, true, false)}, ERROR_LINK_DESTINATION, 'tablespace symlink ../base destination must not be in $PGDATA'); testFileRemove("${strTblSpcPath}/${strTblspcId}"); @@ -792,7 +792,7 @@ sub run $strBackupManifestFile, {bLoad => false, strDbVersion => PG_VERSION_94, iDbCatalogVersion => $self->dbCatalogVersion(PG_VERSION_94)}); $self->testException( - sub {$oManifest->build(storageDb(), $self->{strDbPath}, undef, true, false)}, ERROR_TABLESPACE_IN_PGDATA, + sub {$oManifest->build(storageDb(), $self->{strDbPath}, undef, true, false)}, ERROR_LINK_DESTINATION, "tablespace symlink $self->{strDbPath}/base destination must not be in \$PGDATA"); testFileRemove("${strTblSpcPath}/${strTblspcId}"); diff --git a/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm b/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm index 622941d9e..a253558f9 100644 --- a/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm +++ b/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm @@ -764,7 +764,7 @@ sub run $oHostBackup->backup( $strType, 'invalid relative tablespace is ../', - {oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_TABLESPACE_IN_PGDATA}); + {oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_LINK_DESTINATION}); testFileRemove("${strTblSpcPath}/99999"); @@ -772,7 +772,7 @@ sub run $oHostBackup->backup( $strType, 'invalid relative tablespace is ..', - {oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_TABLESPACE_IN_PGDATA}); + {oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_LINK_DESTINATION}); testFileRemove("${strTblSpcPath}/99999"); @@ -780,7 +780,7 @@ sub run $oHostBackup->backup( $strType, 'invalid relative tablespace is ../../$PGDATA', - {oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_TABLESPACE_IN_PGDATA}); + {oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_LINK_DESTINATION}); testFileRemove("${strTblSpcPath}/99999"); @@ -788,7 +788,7 @@ sub run $oHostBackup->backup( $strType, 'invalid relative tablespace is ../../$PGDATA', - {oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_TABLESPACE_IN_PGDATA}); + {oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_LINK_DESTINATION}); testFileRemove("${strTblSpcPath}/99999"); @@ -809,7 +809,7 @@ sub run $oHostBackup->backup( $strType, 'invalid relative tablespace in $PGDATA', - {oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_TABLESPACE_IN_PGDATA}); + {oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_LINK_DESTINATION}); testFileRemove("${strTblSpcPath}/99999"); @@ -830,7 +830,7 @@ sub run $oHostBackup->backup( $strType, 'invalid tablespace in $PGDATA', - {oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_TABLESPACE_IN_PGDATA}); + {oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_LINK_DESTINATION}); testFileRemove("${strTblSpcPath}/99999"); [parent: 33a63aae503a]