diff --git a/INSTALL.md b/INSTALL.md index ff7df87e7..3253c4fbd 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -47,7 +47,7 @@ cpanm IO::Uncompress::Gunzip Backrest can be installed by downloading the most recent release: -https://github.com/dwsteele/pg_backrest/releases +https://github.com/pgmasters/backrest/releases 6. To run unit tests: diff --git a/lib/BackRest/Backup.pm b/lib/BackRest/Backup.pm index 31dc39f77..e4a7ae041 100644 --- a/lib/BackRest/Backup.pm +++ b/lib/BackRest/Backup.pm @@ -1437,16 +1437,28 @@ sub backup # will not be attempted. eval { + # Load the aborted manifest my %oAbortedManifest; config_load("${strBackupTmpPath}/backup.manifest", \%oAbortedManifest); - if (defined($oAbortedManifest{backup}{type}) && defined($oBackupManifest{backup}{type}) && - defined($oAbortedManifest{backup}{prior}) && defined($oBackupManifest{backup}{prior}) && - defined($oAbortedManifest{backup}{version}) && defined($oBackupManifest{backup}{version})) + # Default values if they are not set + my $strAbortedType = defined($oAbortedManifest{backup}{type}) ? + defined($oAbortedManifest{backup}{type}) : ''; + my $strAbortedPrior = defined($oAbortedManifest{backup}{prior}) ? + defined($oAbortedManifest{backup}{prior}) : ''; + my $strAbortedVersion = defined($oAbortedManifest{backup}{version}) ? + defined($oAbortedManifest{backup}{version}) : ''; + + # The backup is usable if between the current backup and the aborted backup: + # 1) The version matches + # 2) The type of both is full or the types match and prior matches + if ($strAbortedVersion eq $oBackupManifest{backup}{version}) { - if ($oAbortedManifest{backup}{type} eq $oBackupManifest{backup}{type} && - $oAbortedManifest{backup}{prior} eq $oBackupManifest{backup}{prior} && - $oAbortedManifest{backup}{version} eq $oBackupManifest{backup}{version}) + if ($strAbortedType eq BACKUP_TYPE_FULL && $oBackupManifest{backup}{type} eq BACKUP_TYPE_FULL) + { + $bUsable = true; + } + elsif ($strAbortedType eq $oBackupManifest{backup}{type} && $strAbortedPrior eq $oBackupManifest{backup}{prior}) { $bUsable = true; } diff --git a/test/lib/BackRestTest/BackupTest.pm b/test/lib/BackRestTest/BackupTest.pm index 10462ab1e..f933d7c9a 100755 --- a/test/lib/BackRestTest/BackupTest.pm +++ b/test/lib/BackRestTest/BackupTest.pm @@ -530,8 +530,22 @@ sub BackRestTestBackup_Test } } + #------------------------------------------------------------------------------------------------------------------------------- + # Test backup + # + # Check the backup and restore functionality using synthetic data. + #------------------------------------------------------------------------------------------------------------------------------- + + #------------------------------------------------------------------------------------------------------------------------------- + # Test aborted + # + # Check the aborted backup functionality using synthetic data. + #------------------------------------------------------------------------------------------------------------------------------- + #------------------------------------------------------------------------------------------------------------------------------- # Test full + # + # Check the entire backup mechanism using actual clusters. #------------------------------------------------------------------------------------------------------------------------------- if ($strTest eq 'all' || $strTest eq 'full') {