1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-09-16 09:06:18 +02:00

Changes to the aborted backups code.

This commit is contained in:
David Steele
2014-10-14 15:44:50 -04:00
parent 3a54eaf9de
commit b19dd9b552
3 changed files with 33 additions and 7 deletions

View File

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

View File

@@ -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}) : '<invalid>';
my $strAbortedPrior = defined($oAbortedManifest{backup}{prior}) ?
defined($oAbortedManifest{backup}{prior}) : '<invalid>';
my $strAbortedVersion = defined($oAbortedManifest{backup}{version}) ?
defined($oAbortedManifest{backup}{version}) : '<invalid>';
# 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;
}

View File

@@ -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')
{