1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-04-13 11:30:40 +02:00

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.
This commit is contained in:
David Steele 2019-12-02 10:49:25 -05:00
parent 33a63aae50
commit 8dfe0e48e2
10 changed files with 26 additions and 34 deletions

View File

@ -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

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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,

View File

@ -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);

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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}");

View File

@ -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");