2016-12-23 15:22:59 +02:00
|
|
|
####################################################################################################################################
|
2017-01-05 01:31:16 +02:00
|
|
|
# ExpireExpireTest.pm - Tests for expire command
|
2016-12-23 15:22:59 +02:00
|
|
|
####################################################################################################################################
|
2017-05-12 22:43:04 +02:00
|
|
|
package pgBackRestTest::Module::Expire::ExpireExpireTest;
|
|
|
|
use parent 'pgBackRestTest::Env::HostEnvTest';
|
2016-12-23 15:22:59 +02:00
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# Perl includes
|
|
|
|
####################################################################################################################################
|
|
|
|
use strict;
|
|
|
|
use warnings FATAL => qw(all);
|
|
|
|
use Carp qw(confess);
|
|
|
|
|
|
|
|
use File::Basename qw(dirname);
|
2017-04-03 16:42:55 +02:00
|
|
|
use Storable qw(dclone);
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-06-21 14:02:21 +02:00
|
|
|
use pgBackRest::Archive::Info;
|
2017-05-15 22:01:00 +02:00
|
|
|
use pgBackRest::Backup::Info;
|
2016-12-23 15:22:59 +02:00
|
|
|
use pgBackRest::DbVersion;
|
|
|
|
use pgBackRest::Common::Exception;
|
|
|
|
use pgBackRest::Common::Ini;
|
|
|
|
use pgBackRest::Common::Log;
|
|
|
|
use pgBackRest::Common::Wait;
|
|
|
|
use pgBackRest::Config::Config;
|
2017-04-03 16:42:55 +02:00
|
|
|
use pgBackRest::Expire;
|
2016-12-23 15:22:59 +02:00
|
|
|
use pgBackRest::Manifest;
|
2017-06-09 23:51:41 +02:00
|
|
|
use pgBackRest::Protocol::Storage::Helper;
|
2016-12-23 15:22:59 +02:00
|
|
|
|
|
|
|
use pgBackRestTest::Common::ExecuteTest;
|
|
|
|
use pgBackRestTest::Common::RunTest;
|
2017-05-12 22:43:04 +02:00
|
|
|
use pgBackRestTest::Env::ExpireEnvTest;
|
2017-06-12 16:52:32 +02:00
|
|
|
use pgBackRestTest::Env::Host::HostS3Test;
|
2017-06-09 23:51:41 +02:00
|
|
|
use pgBackRestTest::Env::HostEnvTest;
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-04-03 16:42:55 +02:00
|
|
|
####################################################################################################################################
|
|
|
|
# initStanzaOption
|
|
|
|
####################################################################################################################################
|
|
|
|
sub initStanzaOption
|
|
|
|
{
|
|
|
|
my $self = shift;
|
|
|
|
my $strDbBasePath = shift;
|
|
|
|
my $strRepoPath = shift;
|
2017-06-12 16:52:32 +02:00
|
|
|
my $oHostS3 = shift;
|
2017-04-03 16:42:55 +02:00
|
|
|
|
2017-08-25 22:47:47 +02:00
|
|
|
$self->optionTestSet(CFGOPT_STANZA, $self->stanza());
|
|
|
|
$self->optionTestSet(CFGOPT_DB_PATH, $strDbBasePath);
|
|
|
|
$self->optionTestSet(CFGOPT_REPO_PATH, $strRepoPath);
|
|
|
|
$self->optionTestSet(CFGOPT_LOG_PATH, $self->testPath());
|
2017-04-03 16:42:55 +02:00
|
|
|
|
2017-08-25 22:47:47 +02:00
|
|
|
$self->optionTestSetBool(CFGOPT_ONLINE, false);
|
2017-04-03 16:42:55 +02:00
|
|
|
|
2017-08-25 22:47:47 +02:00
|
|
|
$self->optionTestSet(CFGOPT_DB_TIMEOUT, 5);
|
|
|
|
$self->optionTestSet(CFGOPT_PROTOCOL_TIMEOUT, 6);
|
2017-06-12 16:52:32 +02:00
|
|
|
|
|
|
|
if (defined($oHostS3))
|
|
|
|
{
|
2017-08-25 22:47:47 +02:00
|
|
|
$self->optionTestSet(CFGOPT_REPO_TYPE, CFGOPTVAL_REPO_TYPE_S3);
|
|
|
|
$self->optionTestSet(CFGOPT_REPO_S3_KEY, HOST_S3_ACCESS_KEY);
|
|
|
|
$self->optionTestSet(CFGOPT_REPO_S3_KEY_SECRET, HOST_S3_ACCESS_SECRET_KEY);
|
|
|
|
$self->optionTestSet(CFGOPT_REPO_S3_BUCKET, HOST_S3_BUCKET);
|
|
|
|
$self->optionTestSet(CFGOPT_REPO_S3_ENDPOINT, HOST_S3_ENDPOINT);
|
|
|
|
$self->optionTestSet(CFGOPT_REPO_S3_REGION, HOST_S3_REGION);
|
|
|
|
$self->optionTestSet(CFGOPT_REPO_S3_HOST, $oHostS3->ipGet());
|
|
|
|
$self->optionTestSetBool(CFGOPT_REPO_S3_VERIFY_SSL, false);
|
2017-06-12 16:52:32 +02:00
|
|
|
}
|
2017-04-03 16:42:55 +02:00
|
|
|
}
|
|
|
|
|
2016-12-23 15:22:59 +02:00
|
|
|
####################################################################################################################################
|
|
|
|
# run
|
|
|
|
####################################################################################################################################
|
|
|
|
sub run
|
|
|
|
{
|
|
|
|
my $self = shift;
|
|
|
|
|
2017-04-03 16:42:55 +02:00
|
|
|
use constant SECONDS_PER_DAY => 86400;
|
|
|
|
my $lBaseTime = time() - (SECONDS_PER_DAY * 56);
|
|
|
|
my $strDescription;
|
|
|
|
|
2017-06-12 16:52:32 +02:00
|
|
|
my $bS3 = false;
|
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
foreach my $bRepoEncrypt (false, true)
|
2016-12-23 15:22:59 +02:00
|
|
|
{
|
2017-11-06 19:51:12 +02:00
|
|
|
############################################################################################################################
|
|
|
|
# Pass !$bRepoEncrypt so expect logs are not generated for encryption tests
|
|
|
|
if ($self->begin("local, enc ${bRepoEncrypt}", !$bRepoEncrypt))
|
|
|
|
{
|
|
|
|
# Create hosts, file object, and config
|
|
|
|
my ($oHostDbMaster, $oHostDbStandby, $oHostBackup, $oHostS3) = $self->setup(
|
|
|
|
true, $self->expect(), {bS3 => $bS3, bRepoEncrypt => $bRepoEncrypt});
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
$self->initStanzaOption($oHostDbMaster->dbBasePath(), $oHostBackup->{strRepoPath}, $oHostS3);
|
|
|
|
$self->configTestLoad(CFGCMD_STANZA_CREATE);
|
2017-04-03 16:42:55 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
# Create the test object
|
|
|
|
my $oExpireTest = new pgBackRestTest::Env::ExpireEnvTest(
|
|
|
|
$oHostBackup, $self->backrestExe(), storageRepo(), $self->expect(), $self);
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
$oExpireTest->stanzaCreate($self->stanza(), PG_VERSION_92);
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$strDescription = 'Nothing to expire';
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_INCR, $lBaseTime += SECONDS_PER_DAY, 246);
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
$oExpireTest->process($self->stanza(), 1, 1, CFGOPTVAL_BACKUP_TYPE_FULL, 1, $strDescription);
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$strDescription = 'Expire oldest full backup, archive expire falls on segment major boundary';
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->process($self->stanza(), 1, 1, CFGOPTVAL_BACKUP_TYPE_FULL, 1, $strDescription);
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$strDescription = 'Expire oldest full backup';
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_DIFF, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_DIFF, $lBaseTime += SECONDS_PER_DAY, 256);
|
|
|
|
$oExpireTest->process($self->stanza(), 1, 1, CFGOPTVAL_BACKUP_TYPE_FULL, 1, $strDescription);
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$strDescription = 'Expire oldest diff backup, archive expire does not fall on major segment boundary';
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_DIFF, $lBaseTime += SECONDS_PER_DAY, undef, 0);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_INCR, $lBaseTime += SECONDS_PER_DAY, undef, 0);
|
|
|
|
$oExpireTest->process($self->stanza(), 1, 1, CFGOPTVAL_BACKUP_TYPE_DIFF, 1, $strDescription);
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$strDescription = 'Expire oldest diff backup (cascade to incr)';
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_DIFF, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->process($self->stanza(), 1, 1, CFGOPTVAL_BACKUP_TYPE_DIFF, 1, $strDescription);
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$strDescription = 'Expire archive based on newest incr backup';
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_INCR, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->process($self->stanza(), 1, 1, CFGOPTVAL_BACKUP_TYPE_INCR, 1, $strDescription);
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$strDescription = 'Expire diff treating full as diff';
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_DIFF, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->process($self->stanza(), 2, 1, CFGOPTVAL_BACKUP_TYPE_DIFF, 1, $strDescription);
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$strDescription = 'Expire diff with retention-archive with warning retention-diff not set';
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_DIFF, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_DIFF, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->process($self->stanza(), undef, undef, CFGOPTVAL_BACKUP_TYPE_DIFF, 1, $strDescription);
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$strDescription = 'Expire full with retention-archive with warning retention-full not set';
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->process($self->stanza(), undef, undef, CFGOPTVAL_BACKUP_TYPE_FULL, 1, $strDescription);
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$strDescription = 'Expire no archive with warning since retention-archive not set for INCR';
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_INCR, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->process($self->stanza(), 1, 1, CFGOPTVAL_BACKUP_TYPE_INCR, undef, $strDescription);
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$strDescription = 'Expire no archive with warning since neither retention-archive nor retention-diff is set';
|
2016-12-23 15:22:59 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_DIFF, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_DIFF, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->process($self->stanza(), undef, undef, CFGOPTVAL_BACKUP_TYPE_DIFF, undef, $strDescription);
|
2017-04-03 16:42:55 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$strDescription = 'Use oldest full backup for archive retention';
|
|
|
|
$oExpireTest->process($self->stanza(), 10, 10, CFGOPTVAL_BACKUP_TYPE_FULL, 10, $strDescription);
|
|
|
|
}
|
|
|
|
|
|
|
|
############################################################################################################################
|
|
|
|
# Pass !$bRepoEncrypt so expect logs are not generated for encryption tests
|
|
|
|
if ($self->begin("Expire::stanzaUpgrade, enc ${bRepoEncrypt}", !$bRepoEncrypt))
|
|
|
|
{
|
|
|
|
# Create hosts, file object, and config
|
|
|
|
my ($oHostDbMaster, $oHostDbStandby, $oHostBackup, $oHostS3) = $self->setup(
|
|
|
|
true, $self->expect(), {bS3 => $bS3, bRepoEncrypt => $bRepoEncrypt});
|
2017-04-03 16:42:55 +02:00
|
|
|
|
2017-11-06 19:51:12 +02:00
|
|
|
$self->initStanzaOption($oHostDbMaster->dbBasePath(), $oHostBackup->{strRepoPath}, $oHostS3);
|
|
|
|
$self->configTestLoad(CFGCMD_STANZA_CREATE);
|
|
|
|
|
|
|
|
# Create the test object
|
|
|
|
my $oExpireTest = new pgBackRestTest::Env::ExpireEnvTest(
|
|
|
|
$oHostBackup, $self->backrestExe(), storageRepo(), $self->expect(), $self);
|
|
|
|
|
|
|
|
$oExpireTest->stanzaCreate($self->stanza(), PG_VERSION_92);
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$strDescription = 'Create backups in current db version';
|
|
|
|
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_INCR, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->process($self->stanza(), undef, undef, CFGOPTVAL_BACKUP_TYPE_DIFF, undef, $strDescription);
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$strDescription = 'Upgrade stanza and expire only earliest db backup and archive';
|
|
|
|
|
|
|
|
$oExpireTest->stanzaUpgrade($self->stanza(), PG_VERSION_93);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_INCR, $lBaseTime += SECONDS_PER_DAY, 246);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_DIFF, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->process($self->stanza(), 3, undef, CFGOPTVAL_BACKUP_TYPE_FULL, undef, $strDescription);
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$strDescription = 'Upgrade the stanza, create full back - earliest db orphaned archive removed and earliest full backup ' .
|
|
|
|
'and archive in previous db version removed';
|
|
|
|
|
|
|
|
$oExpireTest->stanzaUpgrade($self->stanza(), PG_VERSION_95);
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->process($self->stanza(), 2, undef, CFGOPTVAL_BACKUP_TYPE_FULL, undef, $strDescription);
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$strDescription = 'Expire all archive last full backup through pitr';
|
|
|
|
|
|
|
|
$oExpireTest->backupCreate($self->stanza(), CFGOPTVAL_BACKUP_TYPE_FULL, $lBaseTime += SECONDS_PER_DAY);
|
|
|
|
$oExpireTest->process($self->stanza(), 3, 1, CFGOPTVAL_BACKUP_TYPE_DIFF, 1, $strDescription);
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$strDescription = 'Expire all archive except for the current database';
|
|
|
|
|
|
|
|
$oExpireTest->process($self->stanza(), 2, undef, CFGOPTVAL_BACKUP_TYPE_FULL, undef, $strDescription);
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------------------------------------------------
|
|
|
|
$self->optionTestClear(CFGOPT_DB_TIMEOUT);
|
|
|
|
$self->optionTestClear(CFGOPT_DB_PATH);
|
|
|
|
$self->optionTestClear(CFGOPT_ONLINE);
|
|
|
|
$self->optionTestClear(CFGOPT_PROTOCOL_TIMEOUT);
|
|
|
|
$self->optionTestSet(CFGOPT_RETENTION_FULL, 1);
|
|
|
|
$self->optionTestSet(CFGOPT_RETENTION_DIFF, 1);
|
|
|
|
$self->optionTestSet(CFGOPT_RETENTION_ARCHIVE_TYPE, CFGOPTVAL_BACKUP_TYPE_FULL);
|
|
|
|
$self->optionTestSet(CFGOPT_RETENTION_ARCHIVE, 1);
|
|
|
|
$self->configTestLoad(CFGCMD_EXPIRE);
|
|
|
|
|
|
|
|
$strDescription = 'Expiration cannot occur due to info file db mismatch';
|
|
|
|
my $oExpire = new pgBackRest::Expire();
|
|
|
|
|
|
|
|
# Mismatched version
|
|
|
|
$oHostBackup->infoMunge(storageRepo()->pathGet(STORAGE_REPO_ARCHIVE . qw{/} . ARCHIVE_INFO_FILE),
|
|
|
|
{&INFO_ARCHIVE_SECTION_DB =>
|
2017-11-19 03:02:54 +02:00
|
|
|
{&INFO_ARCHIVE_KEY_DB_VERSION => PG_VERSION_93,
|
|
|
|
&INFO_ARCHIVE_KEY_DB_SYSTEM_ID => $self->dbSysId(PG_VERSION_95)},
|
2017-11-06 19:51:12 +02:00
|
|
|
&INFO_ARCHIVE_SECTION_DB_HISTORY =>
|
|
|
|
{'3' =>
|
2017-11-19 03:02:54 +02:00
|
|
|
{&INFO_ARCHIVE_KEY_DB_VERSION => PG_VERSION_93,
|
|
|
|
&INFO_ARCHIVE_KEY_DB_ID => $self->dbSysId(PG_VERSION_95)}}});
|
2017-11-06 19:51:12 +02:00
|
|
|
|
|
|
|
$self->testException(sub {$oExpire->process()},
|
|
|
|
ERROR_FILE_INVALID,
|
|
|
|
"archive and backup database versions do not match\n" .
|
|
|
|
"HINT: has a stanza-upgrade been performed?");
|
|
|
|
|
|
|
|
# Restore the info file
|
|
|
|
$oHostBackup->infoRestore(storageRepo()->pathGet(STORAGE_REPO_ARCHIVE . qw{/} . ARCHIVE_INFO_FILE));
|
|
|
|
|
|
|
|
# Mismatched system ID
|
|
|
|
$oHostBackup->infoMunge(storageRepo()->pathGet(STORAGE_REPO_ARCHIVE . qw{/} . ARCHIVE_INFO_FILE),
|
|
|
|
{&INFO_ARCHIVE_SECTION_DB =>
|
|
|
|
{&INFO_ARCHIVE_KEY_DB_SYSTEM_ID => 6999999999999999999},
|
|
|
|
&INFO_ARCHIVE_SECTION_DB_HISTORY =>
|
|
|
|
{'3' =>
|
|
|
|
{&INFO_ARCHIVE_KEY_DB_VERSION => PG_VERSION_95, &INFO_ARCHIVE_KEY_DB_ID => 6999999999999999999}}});
|
|
|
|
|
|
|
|
$self->testException(sub {$oExpire->process()},
|
|
|
|
ERROR_FILE_INVALID,
|
|
|
|
"archive and backup database versions do not match\n" .
|
|
|
|
"HINT: has a stanza-upgrade been performed?");
|
|
|
|
|
|
|
|
# Restore the info file
|
|
|
|
$oHostBackup->infoRestore(storageRepo()->pathGet(STORAGE_REPO_ARCHIVE . qw{/} . ARCHIVE_INFO_FILE));
|
|
|
|
}
|
2016-12-23 15:22:59 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|