diff --git a/doc/xml/release.xml b/doc/xml/release.xml index f801493c3..0e7a2635e 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -111,6 +111,16 @@ + + + + + + +

Fixed an issue where a tablespace link that referenced another link would not produce an error, but instead skip the tablespace entirely.

+
+
+

Experimental support for non-exclusive backups in 9.6 beta4. Changes to the control/catalog/WAL versions in subsequent betas may break compatibility but will be updated with each release to keep pace.

diff --git a/lib/pgBackRest/Manifest.pm b/lib/pgBackRest/Manifest.pm index 3e22ff1c5..44814d569 100644 --- a/lib/pgBackRest/Manifest.pm +++ b/lib/pgBackRest/Manifest.pm @@ -564,6 +564,15 @@ sub build if ($strName ne '.') { + if ($strManifestType eq MANIFEST_VALUE_LINK && $oManifestHash{name}{$strName}{type} eq 'l') + { + confess &log(ERROR, 'link ' . + $self->dbPathGet( + $self->get(MANIFEST_SECTION_BACKUP_TARGET, MANIFEST_TARGET_PGDATA, MANIFEST_SUBKEY_PATH), $strLevel) . + ' (' . $self->get(MANIFEST_SECTION_BACKUP_TARGET, $strLevel, MANIFEST_SUBKEY_PATH) . ')' . + ' cannot reference another link', ERROR_LINK_DESTINATION); + } + # Make sure the current file matches the filter or any files under the filter if (defined($strFilter) && $strName ne $strFilter && index($strName, "${strFilter}/") != 0) { @@ -572,15 +581,6 @@ sub build if ($strManifestType eq MANIFEST_VALUE_LINK) { - if ($oManifestHash{name}{$strName}{type} eq 'l') - { - confess &log(ERROR, 'link ' . - $self->dbPathGet( - $self->get(MANIFEST_SECTION_BACKUP_TARGET, MANIFEST_TARGET_PGDATA, MANIFEST_SUBKEY_PATH), $strLevel) . - ' (' . $self->get(MANIFEST_SECTION_BACKUP_TARGET, $strLevel, MANIFEST_SUBKEY_PATH) . ')' . - ' cannot reference another link', ERROR_LINK_DESTINATION); - } - $strFile = dirname($strFile); $self->set(MANIFEST_SECTION_BACKUP_TARGET, $strLevel, MANIFEST_SUBKEY_PATH, dirname($self->get(MANIFEST_SECTION_BACKUP_TARGET, $strLevel, MANIFEST_SUBKEY_PATH))); diff --git a/test/expect/backup-synthetic-001.log b/test/expect/backup-synthetic-001.log index 3370f0178..1a829ca42 100644 --- a/test/expect/backup-synthetic-001.log +++ b/test/expect/backup-synthetic-001.log @@ -1039,6 +1039,14 @@ incr backup - invalid relative tablespace is ../../$PGDATA (db-master host) ERROR: [146]: tablespace symlink ../../base destination must not be in $PGDATA INFO: backup stop +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 --log-level-console=detail --stanza=db backup +------------------------------------------------------------------------------------------------------------------------------------ + INFO: backup start: --no-compress --config=[TEST_PATH]/db-master/pgbackrest.conf --db-path=[TEST_PATH]/db-master/db/base --lock-path=[TEST_PATH]/db-master/repo/lock --log-level-console=detail --log-level-file=trace --log-path=[TEST_PATH]/db-master/repo/log --no-online --repo-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast + INFO: last backup label = [BACKUP-FULL-2], version = [VERSION-1] + ERROR: [145]: link [TEST_PATH]/db-master/db/base/pg_tblspc/99999 ([TEST_PATH]/db-master/db/intermediate_link) cannot reference another link + INFO: backup stop + incr backup - invalid relative tablespace in $PGDATA (db-master host) > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --log-level-console=detail --stanza=db backup ------------------------------------------------------------------------------------------------------------------------------------ diff --git a/test/lib/pgBackRestTest/Backup/BackupTest.pm b/test/lib/pgBackRestTest/Backup/BackupTest.pm index b45694fda..71951ed25 100755 --- a/test/lib/pgBackRestTest/Backup/BackupTest.pm +++ b/test/lib/pgBackRestTest/Backup/BackupTest.pm @@ -1143,9 +1143,9 @@ sub backupTestRun testPathRemove("${strTblSpcPath}/path"); - # Create a relative link is PGDATA if ($bNeutralTest && !$bRemote) { + # Create a relative link in PGDATA testLinkCreate("${strTblSpcPath}/99999", '../'); $oHostBackup->backup( @@ -1181,6 +1181,18 @@ sub backupTestRun strOptionalParam => '--log-level-console=detail'}); testFileRemove("${strTblSpcPath}/99999"); + + # Create a link to a link + testLinkCreate($oHostDbMaster->dbPath() . "/intermediate_link", $oHostDbMaster->dbPath() . '/tablespace/ts1'); + testLinkCreate("${strTblSpcPath}/99999", $oHostDbMaster->dbPath() . "/intermediate_link"); + + $oHostBackup->backup( + $strType, 'tablespace link references a link', + {oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_LINK_DESTINATION, + strOptionalParam => '--log-level-console=detail'}); + + testFileRemove($oHostDbMaster->dbPath() . "/intermediate_link"); + testFileRemove("${strTblSpcPath}/99999"); } # Create a relative link in PGDATA