2015-06-14 00:25:49 +02:00
|
|
|
####################################################################################################################################
|
|
|
|
# INFO MODULE
|
|
|
|
####################################################################################################################################
|
2016-04-14 15:30:54 +02:00
|
|
|
package pgBackRest::Info;
|
2015-06-14 00:25:49 +02:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings FATAL => qw(all);
|
|
|
|
use Carp qw(confess);
|
|
|
|
|
|
|
|
use Exporter qw(import);
|
2015-08-29 20:20:46 +02:00
|
|
|
our @EXPORT = qw();
|
2015-06-14 00:25:49 +02:00
|
|
|
use File::Basename qw(dirname);
|
|
|
|
|
|
|
|
use lib dirname($0);
|
2016-04-14 15:30:54 +02:00
|
|
|
use pgBackRest::Common::Log;
|
|
|
|
use pgBackRest::Common::Ini;
|
|
|
|
use pgBackRest::Common::String;
|
|
|
|
use pgBackRest::BackupCommon;
|
|
|
|
use pgBackRest::BackupInfo;
|
|
|
|
use pgBackRest::Config::Config;
|
|
|
|
use pgBackRest::File;
|
|
|
|
use pgBackRest::Manifest;
|
2015-06-14 00:25:49 +02:00
|
|
|
|
|
|
|
####################################################################################################################################
|
2016-08-11 23:32:28 +02:00
|
|
|
# Remote operation constants
|
2015-06-14 00:25:49 +02:00
|
|
|
####################################################################################################################################
|
2016-08-11 23:32:28 +02:00
|
|
|
use constant OP_INFO => 'Info';
|
|
|
|
|
|
|
|
use constant OP_INFO_STANZA_LIST => OP_INFO . '->stanzaList';
|
2015-08-29 20:20:46 +02:00
|
|
|
push @EXPORT, qw(OP_INFO_STANZA_LIST);
|
2015-06-14 00:25:49 +02:00
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# Info constants
|
|
|
|
####################################################################################################################################
|
|
|
|
use constant INFO_SECTION_BACKREST => 'backrest';
|
|
|
|
use constant INFO_SECTION_ARCHIVE => 'archive';
|
|
|
|
use constant INFO_SECTION_DB => 'database';
|
|
|
|
use constant INFO_SECTION_INFO => 'info';
|
|
|
|
use constant INFO_SECTION_REPO => 'repository';
|
|
|
|
use constant INFO_SECTION_TIMESTAMP => 'timestamp';
|
|
|
|
use constant INFO_SECTION_STATUS => 'status';
|
|
|
|
|
|
|
|
use constant INFO_STANZA_NAME => 'name';
|
|
|
|
|
|
|
|
use constant INFO_STANZA_STATUS_OK => 'ok';
|
|
|
|
use constant INFO_STANZA_STATUS_ERROR => 'error';
|
|
|
|
|
|
|
|
use constant INFO_STANZA_STATUS_OK_CODE => 0;
|
|
|
|
use constant INFO_STANZA_STATUS_OK_MESSAGE => INFO_STANZA_STATUS_OK;
|
|
|
|
use constant INFO_STANZA_STATUS_MISSING_STANZA_CODE => 1;
|
|
|
|
use constant INFO_STANZA_STATUS_MISSING_STANZA_MESSAGE => 'missing stanza path';
|
|
|
|
use constant INFO_STANZA_STATUS_NO_BACKUP_CODE => 2;
|
|
|
|
use constant INFO_STANZA_STATUS_NO_BACKUP_MESSAGE => 'no valid backups';
|
|
|
|
|
|
|
|
use constant INFO_KEY_CODE => 'code';
|
|
|
|
use constant INFO_KEY_DELTA => 'delta';
|
|
|
|
use constant INFO_KEY_FORMAT => 'format';
|
|
|
|
use constant INFO_KEY_ID => 'id';
|
|
|
|
use constant INFO_KEY_LABEL => 'label';
|
|
|
|
use constant INFO_KEY_MESSAGE => 'message';
|
|
|
|
use constant INFO_KEY_PRIOR => 'prior';
|
|
|
|
use constant INFO_KEY_REFERENCE => 'reference';
|
|
|
|
use constant INFO_KEY_SIZE => 'size';
|
|
|
|
use constant INFO_KEY_START => 'start';
|
|
|
|
use constant INFO_KEY_STOP => 'stop';
|
|
|
|
use constant INFO_KEY_SYSTEM_ID => 'system-id';
|
|
|
|
use constant INFO_KEY_TYPE => 'type';
|
|
|
|
use constant INFO_KEY_VERSION => 'version';
|
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# CONSTRUCTOR
|
|
|
|
####################################################################################################################################
|
|
|
|
sub new
|
|
|
|
{
|
|
|
|
my $class = shift; # Class name
|
|
|
|
|
|
|
|
# Create the class hash
|
|
|
|
my $self = {};
|
|
|
|
bless $self, $class;
|
|
|
|
|
2015-08-29 20:20:46 +02:00
|
|
|
# Assign function parameters, defaults, and log debug info
|
2016-08-11 23:32:28 +02:00
|
|
|
my ($strOperation) = logDebugParam(__PACKAGE__ . '->new');
|
2015-08-29 20:20:46 +02:00
|
|
|
|
|
|
|
# Return from function and log return values if any
|
|
|
|
return logDebugReturn
|
|
|
|
(
|
|
|
|
$strOperation,
|
|
|
|
{name => 'self', value => $self}
|
|
|
|
);
|
2015-06-14 00:25:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
####################################################################################################################################
|
2015-08-29 20:20:46 +02:00
|
|
|
# process
|
2015-06-14 00:25:49 +02:00
|
|
|
####################################################################################################################################
|
2015-08-29 20:20:46 +02:00
|
|
|
sub process
|
2015-06-14 00:25:49 +02:00
|
|
|
{
|
|
|
|
my $self = shift;
|
|
|
|
|
2015-08-29 20:20:46 +02:00
|
|
|
# Assign function parameters, defaults, and log debug info
|
2016-08-11 23:32:28 +02:00
|
|
|
my ($strOperation) = logDebugParam(__PACKAGE__ . '->process');
|
2015-08-29 20:20:46 +02:00
|
|
|
|
2015-06-14 00:25:49 +02:00
|
|
|
# Get stanza if specified
|
|
|
|
my $strStanza = optionTest(OPTION_STANZA) ? optionGet(OPTION_STANZA) : undef;
|
|
|
|
|
|
|
|
# Create the file object
|
2016-04-14 15:30:54 +02:00
|
|
|
my $oFile = new pgBackRest::File
|
2015-06-14 00:25:49 +02:00
|
|
|
(
|
|
|
|
$strStanza,
|
2016-04-14 15:30:54 +02:00
|
|
|
optionGet(OPTION_REPO_PATH),
|
2015-06-14 00:25:49 +02:00
|
|
|
optionRemoteTypeTest(BACKUP) ? BACKUP : NONE,
|
2015-06-17 17:26:07 +02:00
|
|
|
protocolGet(!optionRemoteTypeTest(BACKUP))
|
2015-06-14 00:25:49 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
# Get the stanza list with all info
|
2015-08-29 20:20:46 +02:00
|
|
|
my $oyStanzaList = $self->stanzaList($oFile, $strStanza);
|
2015-06-14 00:25:49 +02:00
|
|
|
|
|
|
|
if (optionTest(OPTION_OUTPUT, INFO_OUTPUT_TEXT))
|
|
|
|
{
|
|
|
|
my $strOutput;
|
|
|
|
|
2015-08-29 20:20:46 +02:00
|
|
|
foreach my $oStanzaInfo (@{$oyStanzaList})
|
2015-06-14 00:25:49 +02:00
|
|
|
{
|
2016-05-06 16:25:46 +02:00
|
|
|
# Add an LF between stanzas
|
|
|
|
$strOutput .= defined($strOutput) ? "\n" : '';
|
2015-06-14 00:25:49 +02:00
|
|
|
|
2016-05-06 16:25:46 +02:00
|
|
|
# Output stanza name and status
|
|
|
|
$strOutput .=
|
|
|
|
'stanza: ' . $$oStanzaInfo{&INFO_STANZA_NAME} . "\n" .
|
|
|
|
' status: ' . ($$oStanzaInfo{&INFO_SECTION_STATUS}{&INFO_KEY_CODE} == 0 ? INFO_STANZA_STATUS_OK :
|
|
|
|
INFO_STANZA_STATUS_ERROR . ' (' . $$oStanzaInfo{&INFO_SECTION_STATUS}{&INFO_KEY_MESSAGE} . ')') . "\n";
|
2015-06-14 00:25:49 +02:00
|
|
|
|
2016-05-06 16:25:46 +02:00
|
|
|
# Output information for each stanza backup, from oldest to newest
|
|
|
|
foreach my $oBackupInfo (@{$$oStanzaInfo{&INFO_BACKUP_SECTION_BACKUP}})
|
2015-06-14 00:25:49 +02:00
|
|
|
{
|
2016-05-06 16:25:46 +02:00
|
|
|
$strOutput .=
|
|
|
|
"\n".
|
|
|
|
' ' . $$oBackupInfo{&INFO_KEY_TYPE} . ' backup: ' . $$oBackupInfo{&INFO_KEY_LABEL} . "\n" .
|
|
|
|
|
|
|
|
' start / stop timestamp: ' .
|
|
|
|
timestampFormat(undef, $$oBackupInfo{&INFO_SECTION_TIMESTAMP}{&INFO_KEY_START}) .
|
|
|
|
' / ' .
|
|
|
|
timestampFormat(undef, $$oBackupInfo{&INFO_SECTION_TIMESTAMP}{&INFO_KEY_STOP}) . "\n" .
|
|
|
|
|
|
|
|
' database size: ' .
|
|
|
|
(defined($$oBackupInfo{&INFO_SECTION_INFO}{&INFO_KEY_SIZE}) ?
|
|
|
|
fileSizeFormat($$oBackupInfo{&INFO_SECTION_INFO}{&INFO_KEY_SIZE}) : '') .
|
|
|
|
', backup size: ' .
|
|
|
|
(defined($$oBackupInfo{&INFO_SECTION_INFO}{&INFO_KEY_DELTA}) ?
|
|
|
|
fileSizeFormat($$oBackupInfo{&INFO_SECTION_INFO}{&INFO_KEY_DELTA}) : '') . "\n" .
|
|
|
|
|
|
|
|
' repository size: ' .
|
|
|
|
(defined($$oBackupInfo{&INFO_SECTION_INFO}{&INFO_SECTION_REPO}{&INFO_KEY_SIZE}) ?
|
|
|
|
fileSizeFormat($$oBackupInfo{&INFO_SECTION_INFO}{&INFO_SECTION_REPO}{&INFO_KEY_SIZE}) : '') .
|
|
|
|
', repository backup size: ' .
|
|
|
|
(defined($$oBackupInfo{&INFO_SECTION_INFO}{&INFO_SECTION_REPO}{&INFO_KEY_DELTA}) ?
|
|
|
|
fileSizeFormat($$oBackupInfo{&INFO_SECTION_INFO}{&INFO_SECTION_REPO}{&INFO_KEY_DELTA}) : '') . "\n";
|
|
|
|
|
|
|
|
# List the backup reference chain, if any, for this backup
|
|
|
|
if (defined($$oBackupInfo{&INFO_KEY_REFERENCE}))
|
|
|
|
{
|
|
|
|
$strOutput .= ' backup reference list: ' . (join(', ' ,@{$$oBackupInfo{&INFO_KEY_REFERENCE}})) . "\n";
|
|
|
|
}
|
2015-06-14 00:25:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-08 22:44:47 +02:00
|
|
|
if (defined($strOutput))
|
|
|
|
{
|
|
|
|
syswrite(*STDOUT, $strOutput);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
syswrite(*STDOUT, 'No stanzas exist in ' . $oFile->pathGet(PATH_BACKUP) . ".\n");
|
|
|
|
}
|
2015-06-14 00:25:49 +02:00
|
|
|
}
|
|
|
|
elsif (optionTest(OPTION_OUTPUT, INFO_OUTPUT_JSON))
|
|
|
|
{
|
|
|
|
my $oJSON = JSON::PP->new()->canonical()->pretty()->indent_length(4);
|
2015-08-29 20:20:46 +02:00
|
|
|
my $strJSON = $oJSON->encode($oyStanzaList);
|
2015-08-01 23:23:28 +02:00
|
|
|
|
|
|
|
syswrite(*STDOUT, $strJSON);
|
|
|
|
|
|
|
|
# On some systems a linefeed will be appended by encode() but others will not have it. In our case there should always
|
|
|
|
# be a terminating linefeed.
|
|
|
|
if ($strJSON !~ /\n$/)
|
|
|
|
{
|
|
|
|
syswrite(*STDOUT, "\n");
|
|
|
|
}
|
2015-06-14 00:25:49 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
confess &log(ASSERT, "invalid info output option '" . optionGet(OPTION_OUTPUT) . "'");
|
|
|
|
}
|
|
|
|
|
2015-08-29 20:20:46 +02:00
|
|
|
# Return from function and log return values if any
|
|
|
|
return logDebugReturn
|
|
|
|
(
|
|
|
|
$strOperation,
|
|
|
|
{name => 'iResult', value => 0, trace => true}
|
|
|
|
);
|
2015-06-14 00:25:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
####################################################################################################################################
|
2015-08-29 20:20:46 +02:00
|
|
|
# stanzaList
|
2015-06-14 00:25:49 +02:00
|
|
|
####################################################################################################################################
|
2015-08-29 20:20:46 +02:00
|
|
|
sub stanzaList
|
2015-06-14 00:25:49 +02:00
|
|
|
{
|
|
|
|
my $self = shift;
|
|
|
|
|
2015-08-29 20:20:46 +02:00
|
|
|
# Assign function parameters, defaults, and log debug info
|
|
|
|
my
|
|
|
|
(
|
|
|
|
$strOperation,
|
|
|
|
$oFile,
|
|
|
|
$strStanza
|
|
|
|
) =
|
|
|
|
logDebugParam
|
|
|
|
(
|
2016-08-11 23:32:28 +02:00
|
|
|
__PACKAGE__ . '->stanzaList', \@_,
|
2015-08-29 20:20:46 +02:00
|
|
|
{name => 'oFile'},
|
|
|
|
{name => 'strStanza', required => false}
|
|
|
|
);
|
|
|
|
|
|
|
|
my @oyStanzaList;
|
|
|
|
|
|
|
|
if ($oFile->isRemote(PATH_BACKUP))
|
2015-06-14 00:25:49 +02:00
|
|
|
{
|
|
|
|
# Build param hash
|
|
|
|
my $oParamHash = undef;
|
|
|
|
|
|
|
|
if (defined($strStanza))
|
|
|
|
{
|
|
|
|
$$oParamHash{'stanza'} = $strStanza;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Trace the remote parameters
|
2015-08-29 20:20:46 +02:00
|
|
|
&log(TRACE, OP_INFO_STANZA_LIST . ": remote (" . $oFile->{oProtocol}->commandParamString($oParamHash) . ')');
|
2015-06-14 00:25:49 +02:00
|
|
|
|
|
|
|
# Execute the command
|
2015-08-29 20:20:46 +02:00
|
|
|
my $strStanzaList = $oFile->{oProtocol}->cmdExecute(OP_INFO_STANZA_LIST, $oParamHash, true);
|
2015-06-14 00:25:49 +02:00
|
|
|
|
|
|
|
# Trace the remote response
|
2015-08-29 20:20:46 +02:00
|
|
|
&log(TRACE, OP_INFO_STANZA_LIST . ": remote json response (${strStanzaList})");
|
2015-06-14 00:25:49 +02:00
|
|
|
|
|
|
|
my $oJSON = JSON::PP->new();
|
|
|
|
return $oJSON->decode($strStanzaList);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-06-18 22:55:09 +02:00
|
|
|
my @stryStanza = $oFile->list(PATH_BACKUP, CMD_BACKUP, undef, undef, true);
|
2015-06-14 00:25:49 +02:00
|
|
|
|
|
|
|
foreach my $strStanzaFound (@stryStanza)
|
|
|
|
{
|
|
|
|
if (defined($strStanza) && $strStanza ne $strStanzaFound)
|
|
|
|
{
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
my $oStanzaInfo = {};
|
|
|
|
$$oStanzaInfo{&INFO_STANZA_NAME} = $strStanzaFound;
|
|
|
|
($$oStanzaInfo{&INFO_BACKUP_SECTION_BACKUP}, $$oStanzaInfo{&INFO_BACKUP_SECTION_DB}) =
|
2015-08-29 20:20:46 +02:00
|
|
|
$self->backupList($oFile, $strStanzaFound);
|
2015-06-14 00:25:49 +02:00
|
|
|
|
|
|
|
if (@{$$oStanzaInfo{&INFO_BACKUP_SECTION_BACKUP}} == 0)
|
|
|
|
{
|
|
|
|
$$oStanzaInfo{&INFO_SECTION_STATUS} =
|
|
|
|
{
|
|
|
|
&INFO_KEY_CODE => INFO_STANZA_STATUS_NO_BACKUP_CODE,
|
|
|
|
&INFO_KEY_MESSAGE => INFO_STANZA_STATUS_NO_BACKUP_MESSAGE
|
|
|
|
};
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$$oStanzaInfo{&INFO_SECTION_STATUS} =
|
|
|
|
{
|
|
|
|
&INFO_KEY_CODE => INFO_STANZA_STATUS_OK_CODE,
|
|
|
|
&INFO_KEY_MESSAGE => INFO_STANZA_STATUS_OK_MESSAGE
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2015-08-29 20:20:46 +02:00
|
|
|
push @oyStanzaList, $oStanzaInfo;
|
2015-06-14 00:25:49 +02:00
|
|
|
}
|
|
|
|
|
2015-08-29 20:20:46 +02:00
|
|
|
if (defined($strStanza) && @oyStanzaList == 0)
|
2015-06-14 00:25:49 +02:00
|
|
|
{
|
|
|
|
my $oStanzaInfo = {};
|
|
|
|
|
|
|
|
$$oStanzaInfo{&INFO_STANZA_NAME} = $strStanza;
|
|
|
|
|
|
|
|
$$oStanzaInfo{&INFO_SECTION_STATUS} =
|
|
|
|
{
|
|
|
|
&INFO_KEY_CODE => INFO_STANZA_STATUS_MISSING_STANZA_CODE,
|
|
|
|
&INFO_KEY_MESSAGE => INFO_STANZA_STATUS_MISSING_STANZA_MESSAGE
|
|
|
|
};
|
|
|
|
|
|
|
|
$$oStanzaInfo{&INFO_BACKUP_SECTION_BACKUP} = [];
|
|
|
|
$$oStanzaInfo{&INFO_BACKUP_SECTION_DB} = [];
|
|
|
|
|
2015-08-29 20:20:46 +02:00
|
|
|
push @oyStanzaList, $oStanzaInfo;
|
2015-06-14 00:25:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-29 20:20:46 +02:00
|
|
|
# Return from function and log return values if any
|
|
|
|
return logDebugReturn
|
|
|
|
(
|
|
|
|
$strOperation,
|
|
|
|
{name => 'oyStanzaList', value => \@oyStanzaList, log => false, ref => true}
|
|
|
|
);
|
2015-06-14 00:25:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
####################################################################################################################################
|
2015-08-29 20:20:46 +02:00
|
|
|
# backupList
|
2015-06-14 00:25:49 +02:00
|
|
|
###################################################################################################################################
|
2015-08-29 20:20:46 +02:00
|
|
|
sub backupList
|
2015-06-14 00:25:49 +02:00
|
|
|
{
|
|
|
|
my $self = shift;
|
2015-08-29 20:20:46 +02:00
|
|
|
|
|
|
|
# Assign function parameters, defaults, and log debug info
|
|
|
|
my
|
|
|
|
(
|
|
|
|
$strOperation,
|
|
|
|
$oFile,
|
|
|
|
$strStanza
|
|
|
|
) =
|
|
|
|
logDebugParam
|
|
|
|
(
|
2016-08-11 23:32:28 +02:00
|
|
|
__PACKAGE__ . '->backupList', \@_,
|
2015-08-29 20:20:46 +02:00
|
|
|
{name => 'oFile'},
|
|
|
|
{name => 'strStanza'}
|
|
|
|
);
|
2015-06-14 00:25:49 +02:00
|
|
|
|
|
|
|
# Load or build backup.info
|
2016-04-14 15:30:54 +02:00
|
|
|
my $oBackupInfo = new pgBackRest::BackupInfo($oFile->pathGet(PATH_BACKUP, CMD_BACKUP . "/${strStanza}"));
|
2015-06-14 00:25:49 +02:00
|
|
|
|
|
|
|
# Build the db list
|
|
|
|
my @oyDbList;
|
|
|
|
|
|
|
|
foreach my $iHistoryId ($oBackupInfo->keys(INFO_BACKUP_SECTION_DB_HISTORY))
|
|
|
|
{
|
|
|
|
my $oDbHash =
|
|
|
|
{
|
|
|
|
&INFO_KEY_ID => $iHistoryId,
|
|
|
|
&INFO_KEY_VERSION =>
|
|
|
|
$oBackupInfo->get(INFO_BACKUP_SECTION_DB_HISTORY, $iHistoryId, INFO_BACKUP_KEY_DB_VERSION),
|
|
|
|
&INFO_KEY_SYSTEM_ID =>
|
|
|
|
$oBackupInfo->get(INFO_BACKUP_SECTION_DB_HISTORY, $iHistoryId, INFO_BACKUP_KEY_SYSTEM_ID)
|
|
|
|
};
|
|
|
|
|
|
|
|
push(@oyDbList, $oDbHash);
|
|
|
|
}
|
|
|
|
|
|
|
|
# Build the backup list
|
|
|
|
my @oyBackupList;
|
|
|
|
|
|
|
|
foreach my $strBackup ($oBackupInfo->keys(INFO_BACKUP_SECTION_BACKUP_CURRENT))
|
|
|
|
{
|
|
|
|
my $oBackupHash =
|
|
|
|
{
|
|
|
|
&INFO_SECTION_ARCHIVE =>
|
|
|
|
{
|
|
|
|
&INFO_KEY_START =>
|
|
|
|
$oBackupInfo->get(INFO_BACKUP_SECTION_BACKUP_CURRENT, $strBackup, INFO_BACKUP_KEY_ARCHIVE_START, false),
|
|
|
|
&INFO_KEY_STOP =>
|
|
|
|
$oBackupInfo->get(INFO_BACKUP_SECTION_BACKUP_CURRENT, $strBackup, INFO_BACKUP_KEY_ARCHIVE_STOP, false),
|
|
|
|
},
|
|
|
|
&INFO_SECTION_BACKREST =>
|
|
|
|
{
|
|
|
|
&INFO_KEY_FORMAT =>
|
2015-08-29 20:20:46 +02:00
|
|
|
$oBackupInfo->numericGet(INFO_BACKUP_SECTION_BACKUP_CURRENT, $strBackup, INI_KEY_FORMAT),
|
2015-06-14 00:25:49 +02:00
|
|
|
&INFO_KEY_VERSION =>
|
|
|
|
$oBackupInfo->get(INFO_BACKUP_SECTION_BACKUP_CURRENT, $strBackup, INI_KEY_VERSION)
|
|
|
|
},
|
|
|
|
&INFO_SECTION_DB =>
|
|
|
|
{
|
|
|
|
&INFO_KEY_ID =>
|
2015-08-29 20:20:46 +02:00
|
|
|
$oBackupInfo->numericGet(INFO_BACKUP_SECTION_BACKUP_CURRENT, $strBackup, INFO_BACKUP_KEY_HISTORY_ID)
|
2015-06-14 00:25:49 +02:00
|
|
|
},
|
|
|
|
&INFO_SECTION_INFO =>
|
|
|
|
{
|
|
|
|
&INFO_SECTION_REPO =>
|
|
|
|
{
|
2016-05-06 16:25:46 +02:00
|
|
|
# Size of the backup in the repository, taking compression into account
|
2015-06-14 00:25:49 +02:00
|
|
|
&INFO_KEY_SIZE =>
|
|
|
|
$oBackupInfo->get(INFO_BACKUP_SECTION_BACKUP_CURRENT, $strBackup, INFO_BACKUP_KEY_BACKUP_REPO_SIZE),
|
2016-05-06 16:25:46 +02:00
|
|
|
# Size of this backup only (does not include referenced backups like repo->size)
|
2015-06-14 00:25:49 +02:00
|
|
|
&INFO_KEY_DELTA =>
|
|
|
|
$oBackupInfo->get(INFO_BACKUP_SECTION_BACKUP_CURRENT, $strBackup, INFO_BACKUP_KEY_BACKUP_REPO_SIZE_DELTA),
|
|
|
|
},
|
2016-05-06 16:25:46 +02:00
|
|
|
# Original database size
|
2015-06-14 00:25:49 +02:00
|
|
|
&INFO_KEY_SIZE =>
|
|
|
|
$oBackupInfo->get(INFO_BACKUP_SECTION_BACKUP_CURRENT, $strBackup, INFO_BACKUP_KEY_BACKUP_SIZE),
|
2016-05-06 16:25:46 +02:00
|
|
|
# Amount of database backed up (will be equal for full backups)
|
2015-06-14 00:25:49 +02:00
|
|
|
&INFO_KEY_DELTA =>
|
|
|
|
$oBackupInfo->get(INFO_BACKUP_SECTION_BACKUP_CURRENT, $strBackup, INFO_BACKUP_KEY_BACKUP_SIZE_DELTA),
|
|
|
|
},
|
|
|
|
&INFO_SECTION_TIMESTAMP =>
|
|
|
|
{
|
|
|
|
&INFO_KEY_START =>
|
2015-08-29 20:20:46 +02:00
|
|
|
$oBackupInfo->numericGet(INFO_BACKUP_SECTION_BACKUP_CURRENT, $strBackup, INFO_BACKUP_KEY_TIMESTAMP_START),
|
2015-06-14 00:25:49 +02:00
|
|
|
&INFO_KEY_STOP =>
|
2015-08-29 20:20:46 +02:00
|
|
|
$oBackupInfo->numericGet(INFO_BACKUP_SECTION_BACKUP_CURRENT, $strBackup, INFO_BACKUP_KEY_TIMESTAMP_STOP),
|
2015-06-14 00:25:49 +02:00
|
|
|
},
|
|
|
|
&INFO_KEY_LABEL => $strBackup,
|
|
|
|
&INFO_KEY_PRIOR =>
|
|
|
|
$oBackupInfo->get(INFO_BACKUP_SECTION_BACKUP_CURRENT, $strBackup, INFO_BACKUP_KEY_PRIOR, false),
|
|
|
|
&INFO_KEY_REFERENCE =>
|
|
|
|
$oBackupInfo->get(INFO_BACKUP_SECTION_BACKUP_CURRENT, $strBackup, INFO_BACKUP_KEY_REFERENCE, false),
|
|
|
|
&INFO_KEY_TYPE =>
|
|
|
|
$oBackupInfo->get(INFO_BACKUP_SECTION_BACKUP_CURRENT, $strBackup, INFO_BACKUP_KEY_TYPE)
|
|
|
|
};
|
|
|
|
|
|
|
|
push(@oyBackupList, $oBackupHash);
|
|
|
|
}
|
|
|
|
|
2015-08-29 20:20:46 +02:00
|
|
|
# Return from function and log return values if any
|
|
|
|
return logDebugReturn
|
|
|
|
(
|
|
|
|
$strOperation,
|
|
|
|
{name => 'oyBackupList', value => \@oyBackupList, log => false, ref => true},
|
|
|
|
{name => 'oyDbList', value => \@oyDbList, log => false, ref => true}
|
|
|
|
);
|
2015-06-14 00:25:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|