2015-09-02 01:05:10 +02:00
|
|
|
####################################################################################################################################
|
2015-10-28 11:10:36 +02:00
|
|
|
# ExpireCommonTest.pm - Common code for expire tests
|
2015-09-02 01:05:10 +02:00
|
|
|
####################################################################################################################################
|
2017-01-27 16:42:30 +02:00
|
|
|
package pgBackRestTest::Expire::ExpireEnvTest;
|
2016-12-23 15:22:59 +02:00
|
|
|
use parent 'pgBackRestTest::Common::RunTest';
|
2015-09-02 01:05:10 +02:00
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# Perl includes
|
|
|
|
####################################################################################################################################
|
|
|
|
use strict;
|
|
|
|
use warnings FATAL => qw(all);
|
|
|
|
use Carp qw(confess);
|
|
|
|
|
2017-02-05 17:31:29 +02:00
|
|
|
use pgBackRest::Archive::ArchiveInfo;
|
2016-04-14 15:30:54 +02:00
|
|
|
use pgBackRest::BackupCommon;
|
|
|
|
use pgBackRest::BackupInfo;
|
|
|
|
use pgBackRest::Common::Ini;
|
|
|
|
use pgBackRest::Common::Log;
|
|
|
|
use pgBackRest::Config::Config;
|
2016-08-12 04:35:24 +02:00
|
|
|
use pgBackRest::DbVersion;
|
2016-04-14 15:30:54 +02:00
|
|
|
use pgBackRest::File;
|
2016-06-24 14:12:58 +02:00
|
|
|
use pgBackRest::FileCommon;
|
2016-04-14 15:30:54 +02:00
|
|
|
use pgBackRest::Manifest;
|
2016-06-27 02:53:45 +02:00
|
|
|
use pgBackRest::Version;
|
2015-09-02 01:05:10 +02:00
|
|
|
|
2016-12-23 15:22:59 +02:00
|
|
|
use pgBackRestTest::Common::Host::HostBaseTest;
|
2016-04-14 15:30:54 +02:00
|
|
|
use pgBackRestTest::Common::ExecuteTest;
|
2016-06-24 14:12:58 +02:00
|
|
|
use pgBackRestTest::Common::FileTest;
|
2015-09-02 01:05:10 +02:00
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# new
|
|
|
|
####################################################################################################################################
|
|
|
|
sub new
|
|
|
|
{
|
|
|
|
my $class = shift; # Class name
|
|
|
|
|
|
|
|
# Create the class hash
|
|
|
|
my $self = {};
|
|
|
|
bless $self, $class;
|
|
|
|
|
|
|
|
# Assign function parameters, defaults, and log debug info
|
|
|
|
(
|
|
|
|
my $strOperation,
|
2016-06-24 14:12:58 +02:00
|
|
|
$self->{oHostBackup},
|
2016-12-23 15:22:59 +02:00
|
|
|
$self->{strBackRestExe},
|
2015-10-08 17:43:56 +02:00
|
|
|
$self->{oFile},
|
|
|
|
$self->{oLogTest}
|
2015-09-02 01:05:10 +02:00
|
|
|
) =
|
|
|
|
logDebugParam
|
|
|
|
(
|
2016-08-11 23:32:28 +02:00
|
|
|
__PACKAGE__ . '->new', \@_,
|
2017-02-05 17:31:29 +02:00
|
|
|
{name => 'oHostBackup', required => false, trace => true},
|
2016-12-23 15:22:59 +02:00
|
|
|
{name => 'strBackRestExe', trace => true},
|
2015-10-08 17:43:56 +02:00
|
|
|
{name => 'oFile', trace => true},
|
|
|
|
{name => 'oLogTest', required => false, trace => true}
|
2015-09-02 01:05:10 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
# Return from function and log return values if any
|
|
|
|
return logDebugReturn
|
|
|
|
(
|
|
|
|
$strOperation,
|
|
|
|
{name => 'self', value => $self}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# stanzaCreate
|
|
|
|
####################################################################################################################################
|
|
|
|
sub stanzaCreate
|
|
|
|
{
|
|
|
|
my $self = shift;
|
|
|
|
|
|
|
|
# Assign function parameters, defaults, and log debug info
|
|
|
|
my
|
|
|
|
(
|
|
|
|
$strOperation,
|
|
|
|
$strStanza,
|
|
|
|
$strDbVersion
|
|
|
|
) =
|
|
|
|
logDebugParam
|
|
|
|
(
|
2016-08-11 23:32:28 +02:00
|
|
|
__PACKAGE__ . '->sanzaCreate', \@_,
|
2015-09-02 01:05:10 +02:00
|
|
|
{name => 'strStanza'},
|
|
|
|
{name => 'strDbVersion'}
|
|
|
|
);
|
|
|
|
|
|
|
|
# Assign variables
|
|
|
|
my $oStanza = {};
|
|
|
|
$$oStanza{strDbVersion} = $strDbVersion;
|
|
|
|
$$oStanza{iDbId} = 1;
|
|
|
|
|
|
|
|
# Create the system id
|
|
|
|
my $strDbVersionTemp = $strDbVersion;
|
|
|
|
$strDbVersionTemp =~ s/\.//;
|
|
|
|
$$oStanza{ullDbSysId} = $strDbVersionTemp . '000000000000000' . $$oStanza{iDbId};
|
|
|
|
$$oStanza{iCatalogVersion} = '20' . $strDbVersionTemp . '0101';
|
|
|
|
$$oStanza{iControlVersion} = $strDbVersionTemp . '1';
|
|
|
|
|
|
|
|
# Create the stanza backup path
|
2017-02-05 17:31:29 +02:00
|
|
|
my $strBackupClusterPath = $self->{oFile}->pathGet(PATH_BACKUP_CLUSTER);
|
2016-06-24 14:12:58 +02:00
|
|
|
filePathCreate("${strBackupClusterPath}/" . PATH_BACKUP_HISTORY, undef, undef, true);
|
2015-09-02 01:05:10 +02:00
|
|
|
|
|
|
|
$$oStanza{strBackupClusterPath} = $strBackupClusterPath;
|
|
|
|
|
|
|
|
# Create the backup info object
|
2016-12-20 23:52:20 +02:00
|
|
|
my $oBackupInfo = (new pgBackRest::BackupInfo($$oStanza{strBackupClusterPath}, false, false))->create(
|
|
|
|
$strDbVersion, $$oStanza{ullDbSysId}, $$oStanza{iControlVersion}, $$oStanza{iCatalogVersion});
|
2015-09-02 01:05:10 +02:00
|
|
|
|
|
|
|
# Create the stanza archive path
|
2017-02-05 17:31:29 +02:00
|
|
|
my $strArchiveClusterPath = $self->{oFile}->pathGet(PATH_BACKUP_ARCHIVE);
|
2016-06-24 14:12:58 +02:00
|
|
|
filePathCreate($strArchiveClusterPath, undef, undef, true);
|
2015-09-02 01:05:10 +02:00
|
|
|
|
|
|
|
# Create the archive info object
|
2017-01-11 02:51:20 +02:00
|
|
|
$$oStanza{oArchiveInfo} = new pgBackRest::Archive::ArchiveInfo($strArchiveClusterPath, false);
|
2016-12-20 23:52:20 +02:00
|
|
|
$$oStanza{oArchiveInfo}->create($$oStanza{strDbVersion}, $$oStanza{ullDbSysId});
|
2015-09-02 01:05:10 +02:00
|
|
|
|
|
|
|
# Create the stanza archive version path
|
|
|
|
$strArchiveClusterPath .= '/' . $$oStanza{strDbVersion} . '-' . $$oStanza{iDbId};
|
2016-06-24 14:12:58 +02:00
|
|
|
filePathCreate($strArchiveClusterPath, undef, undef, true);
|
2015-09-02 01:05:10 +02:00
|
|
|
|
|
|
|
$$oStanza{strArchiveClusterPath} = $strArchiveClusterPath;
|
|
|
|
|
|
|
|
$self->{oStanzaHash}{$strStanza} = $oStanza;
|
|
|
|
|
|
|
|
# Return from function and log return values if any
|
2016-08-11 23:32:28 +02:00
|
|
|
return logDebugReturn($strOperation);
|
2015-09-02 01:05:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# backupCreate
|
|
|
|
####################################################################################################################################
|
|
|
|
sub backupCreate
|
|
|
|
{
|
|
|
|
my $self = shift;
|
|
|
|
|
|
|
|
# Assign function parameters, defaults, and log debug info
|
|
|
|
my
|
|
|
|
(
|
|
|
|
$strOperation,
|
|
|
|
$strStanza,
|
|
|
|
$strType,
|
|
|
|
$lTimestamp,
|
|
|
|
$iArchiveBackupTotal,
|
|
|
|
$iArchiveBetweenTotal
|
|
|
|
) =
|
|
|
|
logDebugParam
|
|
|
|
(
|
2016-08-11 23:32:28 +02:00
|
|
|
__PACKAGE__ . '->backupCreate', \@_,
|
2015-09-02 01:05:10 +02:00
|
|
|
{name => 'strStanza'},
|
|
|
|
{name => 'strType'},
|
|
|
|
{name => 'lTimestamp'},
|
|
|
|
{name => 'iArchiveBackupTotal', default => 3},
|
|
|
|
{name => 'iArchiveBetweenTotal', default => 3}
|
|
|
|
);
|
|
|
|
|
|
|
|
my $oStanza = $self->{oStanzaHash}{$strStanza};
|
|
|
|
|
2017-02-05 17:31:29 +02:00
|
|
|
my ($strArchiveStart, $strArchiveStop);
|
|
|
|
|
|
|
|
if ($iArchiveBackupTotal != -1)
|
|
|
|
{
|
|
|
|
($strArchiveStart, $strArchiveStop) = $self->archiveCreate($strStanza, $iArchiveBackupTotal);
|
|
|
|
}
|
2015-09-02 01:05:10 +02:00
|
|
|
|
|
|
|
# Create the manifest
|
|
|
|
my $oLastManifest = $strType ne BACKUP_TYPE_FULL ? $$oStanza{oManifest} : undef;
|
|
|
|
|
|
|
|
my $strBackupLabel =
|
|
|
|
backupLabelFormat($strType,
|
|
|
|
defined($oLastManifest) ? $oLastManifest->get(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_LABEL) : undef,
|
|
|
|
$lTimestamp);
|
|
|
|
|
|
|
|
my $strBackupClusterSetPath .= "$$oStanza{strBackupClusterPath}/${strBackupLabel}";
|
2016-06-24 14:12:58 +02:00
|
|
|
filePathCreate($strBackupClusterSetPath);
|
2015-09-02 01:05:10 +02:00
|
|
|
|
2016-04-15 04:50:02 +02:00
|
|
|
&log(INFO, "create backup ${strBackupLabel}");
|
|
|
|
|
|
|
|
my $strManifestFile = "$$oStanza{strBackupClusterPath}/${strBackupLabel}/" . FILE_MANIFEST;
|
|
|
|
my $oManifest = new pgBackRest::Manifest($strManifestFile, false);
|
2015-09-02 01:05:10 +02:00
|
|
|
|
|
|
|
# Store information about the backup into the backup section
|
|
|
|
$oManifest->set(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_LABEL, undef, $strBackupLabel);
|
|
|
|
$oManifest->boolSet(MANIFEST_SECTION_BACKUP_OPTION, MANIFEST_KEY_ARCHIVE_CHECK, undef, true);
|
|
|
|
$oManifest->boolSet(MANIFEST_SECTION_BACKUP_OPTION, MANIFEST_KEY_ARCHIVE_COPY, undef, false);
|
2016-08-25 17:25:46 +02:00
|
|
|
$oManifest->boolSet(MANIFEST_SECTION_BACKUP_OPTION, MANIFEST_KEY_BACKUP_STANDBY, undef, false);
|
2015-09-02 01:05:10 +02:00
|
|
|
$oManifest->set(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_ARCHIVE_START, undef, $strArchiveStart);
|
|
|
|
$oManifest->set(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_ARCHIVE_STOP, undef, $strArchiveStop);
|
2016-12-13 01:54:07 +02:00
|
|
|
$oManifest->boolSet(MANIFEST_SECTION_BACKUP_OPTION, MANIFEST_KEY_CHECKSUM_PAGE, undef, true);
|
2015-09-02 01:05:10 +02:00
|
|
|
$oManifest->boolSet(MANIFEST_SECTION_BACKUP_OPTION, MANIFEST_KEY_COMPRESS, undef, true);
|
|
|
|
$oManifest->numericSet(INI_SECTION_BACKREST, INI_KEY_FORMAT, undef, BACKREST_FORMAT);
|
|
|
|
$oManifest->boolSet(MANIFEST_SECTION_BACKUP_OPTION, MANIFEST_KEY_HARDLINK, undef, false);
|
2016-02-20 02:32:02 +02:00
|
|
|
$oManifest->boolSet(MANIFEST_SECTION_BACKUP_OPTION, MANIFEST_KEY_ONLINE, undef, true);
|
2015-09-02 01:05:10 +02:00
|
|
|
$oManifest->numericSet(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_TIMESTAMP_START, undef, $lTimestamp);
|
|
|
|
$oManifest->numericSet(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_TIMESTAMP_STOP, undef, $lTimestamp);
|
|
|
|
$oManifest->set(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_TYPE, undef, $strType);
|
|
|
|
$oManifest->set(INI_SECTION_BACKREST, INI_KEY_VERSION, undef, BACKREST_VERSION);
|
|
|
|
|
|
|
|
if ($strType ne BACKUP_TYPE_FULL)
|
|
|
|
{
|
|
|
|
if (!defined($oLastManifest))
|
|
|
|
{
|
|
|
|
confess &log(ERROR, "oLastManifest must be defined when strType = ${strType}");
|
|
|
|
}
|
|
|
|
|
|
|
|
push(my @stryReference, $oLastManifest->get(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_LABEL));
|
|
|
|
|
|
|
|
$oManifest->set(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_PRIOR, undef, $stryReference[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
$oManifest->save();
|
|
|
|
$$oStanza{oManifest} = $oManifest;
|
|
|
|
|
2016-04-15 04:50:02 +02:00
|
|
|
# Create the compressed history manifest
|
|
|
|
$self->{oFile}->compress(PATH_BACKUP_ABSOLUTE, $strManifestFile, false);
|
|
|
|
|
2015-09-02 01:05:10 +02:00
|
|
|
# Add the backup to info
|
2016-04-15 04:50:02 +02:00
|
|
|
my $oBackupInfo = new pgBackRest::BackupInfo($$oStanza{strBackupClusterPath}, false);
|
2015-09-02 01:05:10 +02:00
|
|
|
|
|
|
|
$oBackupInfo->check($$oStanza{strDbVersion}, $$oStanza{iControlVersion}, $$oStanza{iCatalogVersion}, $$oStanza{ullDbSysId});
|
2016-04-15 04:50:02 +02:00
|
|
|
$oBackupInfo->add($oManifest);
|
2015-09-02 01:05:10 +02:00
|
|
|
|
|
|
|
# Create the backup description string
|
|
|
|
if (defined($$oStanza{strBackupDescription}))
|
|
|
|
{
|
|
|
|
$$oStanza{strBackupDescription} .= "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
$$oStanza{strBackupDescription} .=
|
|
|
|
"* ${strType} backup: label = ${strBackupLabel}" .
|
|
|
|
(defined($oLastManifest) ? ', prior = ' . $oLastManifest->get(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_LABEL) : '') .
|
2017-02-05 17:31:29 +02:00
|
|
|
(defined($strArchiveStart) ? ", start = ${strArchiveStart}, stop = ${strArchiveStop}" : ', not online');
|
2015-09-02 01:05:10 +02:00
|
|
|
|
2017-02-05 17:31:29 +02:00
|
|
|
if ($iArchiveBetweenTotal != -1)
|
|
|
|
{
|
|
|
|
$self->archiveCreate($strStanza, $iArchiveBetweenTotal);
|
|
|
|
}
|
2015-09-02 01:05:10 +02:00
|
|
|
|
|
|
|
# Return from function and log return values if any
|
2016-08-11 23:32:28 +02:00
|
|
|
return logDebugReturn($strOperation);
|
2015-09-02 01:05:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# archiveNext
|
|
|
|
####################################################################################################################################
|
|
|
|
sub archiveNext
|
|
|
|
{
|
|
|
|
my $self = shift;
|
|
|
|
|
|
|
|
# Assign function parameters, defaults, and log debug info
|
|
|
|
my
|
|
|
|
(
|
|
|
|
$strOperation,
|
|
|
|
$strArchive,
|
|
|
|
$bSkipFF
|
|
|
|
) =
|
|
|
|
logDebugParam
|
|
|
|
(
|
2016-08-11 23:32:28 +02:00
|
|
|
__PACKAGE__ . '->archiveNext', \@_,
|
2015-09-02 01:05:10 +02:00
|
|
|
{name => 'strArchive', trace => true},
|
|
|
|
{name => 'bSkipFF', trace => true}
|
|
|
|
);
|
|
|
|
|
|
|
|
# Break archive log into components
|
|
|
|
my $lTimeline = hex(substr($strArchive, 0, 8));
|
|
|
|
my $lMajor = hex(substr($strArchive, 8, 8));
|
|
|
|
my $lMinor = hex(substr($strArchive, 16, 8));
|
|
|
|
|
|
|
|
# Increment the minor component (and major when needed)
|
|
|
|
$lMinor += 1;
|
|
|
|
|
|
|
|
if ($bSkipFF && $lMinor == 255 || !$bSkipFF && $lMinor == 256)
|
|
|
|
{
|
|
|
|
$lMajor += 1;
|
|
|
|
$lMinor = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Return from function and log return values if any
|
|
|
|
return logDebugReturn
|
|
|
|
(
|
|
|
|
$strOperation,
|
|
|
|
{name => 'strArchiveNext', value => uc(sprintf("%08x%08x%08x", $lTimeline, $lMajor, $lMinor)), trace => true}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# archiveCreate
|
|
|
|
####################################################################################################################################
|
|
|
|
sub archiveCreate
|
|
|
|
{
|
|
|
|
my $self = shift;
|
|
|
|
|
|
|
|
# Assign function parameters, defaults, and log debug info
|
|
|
|
my
|
|
|
|
(
|
|
|
|
$strOperation,
|
|
|
|
$strStanza,
|
|
|
|
$iArchiveTotal
|
|
|
|
) =
|
|
|
|
logDebugParam
|
|
|
|
(
|
2016-08-11 23:32:28 +02:00
|
|
|
__PACKAGE__ . '->archiveCreate', \@_,
|
2015-09-02 01:05:10 +02:00
|
|
|
{name => 'strStanza'},
|
|
|
|
{name => 'iArchiveTotal'}
|
|
|
|
);
|
|
|
|
|
|
|
|
my $oStanza = $self->{oStanzaHash}{$strStanza};
|
|
|
|
my $iArchiveIdx = 0;
|
2016-05-14 16:33:12 +02:00
|
|
|
my $bSkipFF = $$oStanza{strDbVersion} <= PG_VERSION_92;
|
2015-09-02 01:05:10 +02:00
|
|
|
|
|
|
|
my $strArchive = defined($$oStanza{strArchiveLast}) ? $self->archiveNext($$oStanza{strArchiveLast}, $bSkipFF) :
|
|
|
|
'000000010000000000000000';
|
|
|
|
|
|
|
|
push(my @stryArchive, $strArchive);
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
my $strPath = "$$oStanza{strArchiveClusterPath}/" . substr($strArchive, 0, 16);
|
2016-12-10 16:06:45 +02:00
|
|
|
filePathCreate($strPath, undef, true);
|
2015-09-02 01:05:10 +02:00
|
|
|
|
|
|
|
my $strFile = "${strPath}/${strArchive}-0000000000000000000000000000000000000000" . ($iArchiveIdx % 2 == 0 ? '.gz' : '');
|
2016-06-24 14:12:58 +02:00
|
|
|
testFileCreate($strFile, 'ARCHIVE');
|
2015-09-02 01:05:10 +02:00
|
|
|
|
|
|
|
$iArchiveIdx++;
|
|
|
|
|
|
|
|
if ($iArchiveIdx < $iArchiveTotal)
|
|
|
|
{
|
|
|
|
$strArchive = $self->archiveNext($strArchive, $bSkipFF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while ($iArchiveIdx < $iArchiveTotal);
|
|
|
|
|
|
|
|
push(@stryArchive, $strArchive);
|
|
|
|
$$oStanza{strArchiveLast} = $strArchive;
|
|
|
|
|
|
|
|
# Return from function and log return values if any
|
|
|
|
return logDebugReturn
|
|
|
|
(
|
|
|
|
$strOperation,
|
|
|
|
{name => 'stryArchive', value => \@stryArchive}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2016-01-19 14:39:29 +02:00
|
|
|
####################################################################################################################################
|
|
|
|
# supplementalLog
|
|
|
|
####################################################################################################################################
|
|
|
|
sub supplementalLog
|
|
|
|
{
|
|
|
|
my $self = shift;
|
|
|
|
|
|
|
|
# Assign function parameters, defaults, and log debug info
|
|
|
|
my
|
|
|
|
(
|
|
|
|
$strOperation,
|
|
|
|
$strStanza
|
|
|
|
) =
|
|
|
|
logDebugParam
|
|
|
|
(
|
2016-08-11 23:32:28 +02:00
|
|
|
__PACKAGE__ . '->supplementalLog', \@_,
|
2016-01-19 14:39:29 +02:00
|
|
|
{name => 'strStanza'}
|
|
|
|
);
|
|
|
|
|
|
|
|
my $oStanza = $self->{oStanzaHash}{$strStanza};
|
|
|
|
|
|
|
|
if (defined($self->{oLogTest}))
|
|
|
|
{
|
2016-06-24 14:12:58 +02:00
|
|
|
$self->{oLogTest}->supplementalAdd($self->{oHostBackup}->repoPath() .
|
|
|
|
"/backup/${strStanza}/backup.info", $$oStanza{strBackupDescription});
|
|
|
|
|
|
|
|
executeTest(
|
|
|
|
'ls ' . $self->{oHostBackup}->repoPath() . "/backup/${strStanza} | grep -v \"backup.*\"",
|
|
|
|
{oLogTest => $self->{oLogTest}});
|
2016-01-19 14:39:29 +02:00
|
|
|
|
2016-06-24 14:12:58 +02:00
|
|
|
executeTest(
|
|
|
|
'ls -R ' . $self->{oHostBackup}->repoPath() . "/archive/${strStanza} | grep -v \"archive.info\"",
|
|
|
|
{oLogTest => $self->{oLogTest}});
|
2016-01-19 14:39:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return logDebugReturn($strOperation);
|
|
|
|
}
|
|
|
|
|
2015-09-02 01:05:10 +02:00
|
|
|
####################################################################################################################################
|
|
|
|
# process
|
|
|
|
####################################################################################################################################
|
|
|
|
sub process
|
|
|
|
{
|
|
|
|
my $self = shift;
|
|
|
|
|
|
|
|
# Assign function parameters, defaults, and log debug info
|
|
|
|
my
|
|
|
|
(
|
|
|
|
$strOperation,
|
|
|
|
$strStanza,
|
|
|
|
$iExpireFull,
|
|
|
|
$iExpireDiff,
|
|
|
|
$strExpireArchiveType,
|
|
|
|
$iExpireArchive,
|
|
|
|
$strDescription
|
|
|
|
) =
|
|
|
|
logDebugParam
|
|
|
|
(
|
2016-08-11 23:32:28 +02:00
|
|
|
__PACKAGE__ . '->process', \@_,
|
2015-09-02 01:05:10 +02:00
|
|
|
{name => 'strStanza'},
|
2016-09-07 14:07:37 +02:00
|
|
|
{name => 'iExpireFull', required => false},
|
|
|
|
{name => 'iExpireDiff', required => false},
|
2015-09-02 01:05:10 +02:00
|
|
|
{name => 'strExpireArchiveType'},
|
2016-09-07 14:07:37 +02:00
|
|
|
{name => 'iExpireArchive', required => false},
|
2015-09-02 01:05:10 +02:00
|
|
|
{name => 'strDescription'}
|
|
|
|
);
|
|
|
|
|
|
|
|
my $oStanza = $self->{oStanzaHash}{$strStanza};
|
|
|
|
|
2016-01-19 14:39:29 +02:00
|
|
|
$self->supplementalLog($strStanza);
|
2015-10-08 17:43:56 +02:00
|
|
|
|
2015-09-02 01:05:10 +02:00
|
|
|
undef($$oStanza{strBackupDescription});
|
|
|
|
|
2016-12-23 15:22:59 +02:00
|
|
|
my $strCommand = $self->{strBackRestExe} .
|
2016-06-24 14:12:58 +02:00
|
|
|
' --' . OPTION_CONFIG . '="' . $self->{oHostBackup}->backrestConfig() . '"' .
|
2015-09-02 01:05:10 +02:00
|
|
|
' --' . OPTION_STANZA . '=' . $strStanza .
|
2016-04-15 04:50:02 +02:00
|
|
|
' --' . OPTION_LOG_LEVEL_CONSOLE . '=' . lc(DETAIL);
|
2015-09-02 01:05:10 +02:00
|
|
|
|
|
|
|
if (defined($iExpireFull))
|
|
|
|
{
|
|
|
|
$strCommand .= ' --retention-full=' . $iExpireFull;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (defined($iExpireDiff))
|
|
|
|
{
|
|
|
|
$strCommand .= ' --retention-diff=' . $iExpireDiff;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (defined($strExpireArchiveType))
|
|
|
|
{
|
2016-09-07 14:07:37 +02:00
|
|
|
if (defined($iExpireArchive))
|
|
|
|
{
|
|
|
|
$strCommand .= ' --retention-archive-type=' . $strExpireArchiveType .
|
|
|
|
' --retention-archive=' . $iExpireArchive;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$strCommand .= ' --retention-archive-type=' . $strExpireArchiveType;
|
|
|
|
}
|
2015-09-02 01:05:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$strCommand .= ' expire';
|
|
|
|
|
2016-06-24 14:12:58 +02:00
|
|
|
$self->{oHostBackup}->executeSimple($strCommand, {strComment => $strDescription, oLogTest => $self->{oLogTest}});
|
2015-10-08 17:43:56 +02:00
|
|
|
|
2016-01-19 14:39:29 +02:00
|
|
|
$self->supplementalLog($strStanza);
|
2015-09-02 01:05:10 +02:00
|
|
|
|
|
|
|
# Return from function and log return values if any
|
2016-01-19 14:39:29 +02:00
|
|
|
return logDebugReturn($strOperation);
|
2015-09-02 01:05:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|