1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-05-13 21:56:42 +02:00

Move Perl modules out of lib directory.

This directory was once the home of the production Perl code but since f0ef73db this is no longer true.

Move the modules to test in most cases, except where the module is expected to be useful for the doc engine beyond the expected lifetime of the Perl test code (about a year if all goes well).

The exception is pgBackRest::Version which requires more work to migrate since it is used to track pgBackRest versions.
This commit is contained in:
David Steele 2020-03-10 15:12:44 -04:00
parent c279a00279
commit 36d4ab9bff
79 changed files with 860 additions and 1024 deletions

View File

@ -13,14 +13,14 @@ use Exporter qw(import);
use File::Basename qw(basename);
use Storable qw(dclone);
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRestBuild::Build::Common;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestTest::Common::Storage;
use pgBackRestTest::Common::StoragePosix;
use pgBackRestBuild::Build::Common;
####################################################################################################################################
# Define generator used for auto generated warning messages
####################################################################################################################################

View File

@ -13,8 +13,8 @@ use Exporter qw(import);
our @EXPORT = qw();
use Storable qw(dclone);
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
####################################################################################################################################
# Constants

View File

@ -14,10 +14,11 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Storable qw(dclone);
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Version;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestBuild::Build::Common;
use pgBackRestBuild::Config::BuildDefine;
use pgBackRestBuild::Config::Data;

View File

@ -14,12 +14,12 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Storable qw(dclone);
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Version;
use BackRestDoc::Common::DocConfig;
use BackRestDoc::Common::DocRender;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestBuild::Build::Common;
use pgBackRestBuild::Config::Data;

View File

@ -14,10 +14,11 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Storable qw(dclone);
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Version;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestBuild::Build::Common;
use pgBackRestBuild::Config::Build;
use pgBackRestBuild::Config::Data;

View File

@ -66,12 +66,13 @@ use File::Basename qw(dirname basename);
use Getopt::Long qw(GetOptions);
use Storable qw(dclone);
use pgBackRest::Common::Exception;
use pgBackRest::Common::Io::Base;
use pgBackRest::Common::Log;
use pgBackRest::Common::Wait;
use pgBackRest::Version;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::Wait;
####################################################################################################################################
# Command constants - commands that are allowed in the exe
####################################################################################################################################
@ -1202,7 +1203,7 @@ my %hConfigDefine =
{
&CFGDEF_SECTION => CFGDEF_SECTION_GLOBAL,
&CFGDEF_TYPE => CFGDEF_TYPE_SIZE,
&CFGDEF_DEFAULT => COMMON_IO_BUFFER_MAX,
&CFGDEF_DEFAULT => 4194304,
&CFGDEF_ALLOW_LIST =>
[
&CFGDEF_DEFAULT_BUFFER_SIZE_MIN,

View File

@ -11,11 +11,11 @@ use English '-no_match_vars';
use Exporter qw(import);
our @EXPORT = qw();
use BackRestDoc::Common::Log;
use pgBackRestBuild::Build::Common;
use pgBackRestBuild::Error::Data;
use pgBackRest::Common::Log;
####################################################################################################################################
# Constants
####################################################################################################################################

View File

@ -32,9 +32,9 @@ use BackRestDoc::Html::DocHtmlSite;
use BackRestDoc::Latex::DocLatex;
use BackRestDoc::Markdown::DocMarkdown;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRest::Version;
use pgBackRestTest::Common::ExecuteTest;

View File

@ -13,8 +13,8 @@ use File::Basename qw(dirname);
use Scalar::Util qw(blessed);
use XML::Checker::Parser;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
####################################################################################################################################
# CONSTRUCTOR

View File

@ -11,11 +11,13 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRestBuild::Config::Data;
use pgBackRest::Version;
use pgBackRestBuild::Config::Data;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
####################################################################################################################################
# Help types
####################################################################################################################################

View File

@ -15,19 +15,20 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Storable qw(dclone);
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Version;
use pgBackRestBuild::Config::Data;
use BackRestDoc::Common::DocManifest;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::HostTest;
use pgBackRestTest::Common::HostGroupTest;
use BackRestDoc::Common::DocManifest;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Ini;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
####################################################################################################################################
# User that's building the docs
####################################################################################################################################
@ -526,10 +527,6 @@ sub backrestConfig
if ($self->{bExe} && $self->isRequired($oSection))
{
# Load module dynamically
require pgBackRest::Common::Ini;
pgBackRest::Common::Ini->import();
my ($bCacheHit, $strCacheType, $hCacheKey, $hCacheValue) = $self->cachePop('cfg-' . PROJECT_EXE, $hCacheKey);
if ($bCacheHit)

View File

@ -13,8 +13,8 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use JSON::PP;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
####################################################################################################################################
# File constants

View File

@ -12,10 +12,9 @@ use Exporter qw(import);
use JSON::PP;
use Storable qw(dclone);
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::DocManifest;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
####################################################################################################################################
# XML tag/param constants

View File

@ -1,7 +1,7 @@
####################################################################################################################################
# COMMON EXCEPTION MODULE
####################################################################################################################################
package pgBackRest::Common::Exception;
package BackRestDoc::Common::Exception;
use strict;
use warnings FATAL => qw(all);
@ -158,16 +158,6 @@ sub code
return $self->{iCode};
}
####################################################################################################################################
# Is this a C error?
####################################################################################################################################
sub errorC
{
my $self = shift;
return $self->{bErrorC};
}
####################################################################################################################################
# extra
####################################################################################################################################
@ -211,7 +201,7 @@ sub isException
# If a standard Exception
if (blessed($$roException))
{
return $$roException->isa('pgBackRest::Common::Exception') ? 1 : 0;
return $$roException->isa('BackRestDoc::Common::Exception') ? 1 : 0;
}
# Else if a specially formatted string from the C library
elsif ($$roException =~ /^PGBRCLIB\:[0-9]+\:/)
@ -226,7 +216,7 @@ sub isException
my $strMessage = join(':', @stryException);
# Create exception
$$roException = new pgBackRest::Common::Exception("ERROR", $iCode, $strMessage, $strTrace, undef, 1);
$$roException = new BackRestDoc::Common::Exception("ERROR", $iCode, $strMessage, $strTrace, undef, 1);
return 1;
}

View File

@ -1,7 +1,7 @@
####################################################################################################################################
# COMMON INI MODULE
####################################################################################################################################
package pgBackRest::Common::Ini;
package BackRestDoc::Common::Ini;
use strict;
use warnings FATAL => qw(all);
@ -15,11 +15,12 @@ use File::Basename qw(dirname);
use JSON::PP;
use Storable qw(dclone);
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Version;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
####################################################################################################################################
# Boolean constants
####################################################################################################################################

View File

@ -1,7 +1,7 @@
####################################################################################################################################
# COMMON LOG MODULE
####################################################################################################################################
package pgBackRest::Common::Log;
package BackRestDoc::Common::Log;
use strict;
use warnings FATAL => qw(all);
@ -15,8 +15,8 @@ use File::Basename qw(dirname);
use Scalar::Util qw(blessed reftype);
use Time::HiRes qw(gettimeofday usleep);
use pgBackRest::Common::Exception;
use pgBackRest::Common::String;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::String;
####################################################################################################################################
# Boolean constants
@ -751,7 +751,7 @@ sub log
# Return a typed exception if code is defined
if (defined($iCode))
{
$oErrorLast = new pgBackRest::Common::Exception($strLevel, $iCode, $strMessage, longmess(), $rExtra);
$oErrorLast = new BackRestDoc::Common::Exception($strLevel, $iCode, $strMessage, longmess(), $rExtra);
return $oErrorLast;
}

View File

@ -0,0 +1,121 @@
####################################################################################################################################
# COMMON STRING MODULE
####################################################################################################################################
package BackRestDoc::Common::String;
use strict;
use warnings FATAL => qw(all);
use Carp qw(confess longmess);
use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
####################################################################################################################################
# trim
#
# Trim whitespace.
####################################################################################################################################
sub trim
{
my $strBuffer = shift;
if (!defined($strBuffer))
{
return;
}
$strBuffer =~ s/^\s+|\s+$//g;
return $strBuffer;
}
push @EXPORT, qw(trim);
####################################################################################################################################
# coalesce - return first defined parameter
####################################################################################################################################
sub coalesce
{
foreach my $strParam (@_)
{
if (defined($strParam))
{
return $strParam;
}
}
return;
}
push @EXPORT, qw(coalesce);
####################################################################################################################################
# timestampFormat
#
# Get standard timestamp format (or formatted as specified).
####################################################################################################################################
sub timestampFormat
{
my $strFormat = shift;
my $lTime = shift;
if (!defined($strFormat))
{
$strFormat = '%4d-%02d-%02d %02d:%02d:%02d';
}
if (!defined($lTime))
{
$lTime = time();
}
my ($iSecond, $iMinute, $iHour, $iMonthDay, $iMonth, $iYear, $iWeekDay, $iYearDay, $bIsDst) = localtime($lTime);
if ($strFormat eq "%4d")
{
return sprintf($strFormat, $iYear + 1900)
}
else
{
return sprintf($strFormat, $iYear + 1900, $iMonth + 1, $iMonthDay, $iHour, $iMinute, $iSecond);
}
}
push @EXPORT, qw(timestampFormat);
####################################################################################################################################
# stringSplit
####################################################################################################################################
sub stringSplit
{
my $strString = shift;
my $strChar = shift;
my $iLength = shift;
if (length($strString) <= $iLength)
{
return $strString, undef;
}
my $iPos = index($strString, $strChar);
if ($iPos == -1)
{
return $strString, undef;
}
my $iNewPos = $iPos;
while ($iNewPos != -1 && $iNewPos + 1 < $iLength)
{
$iPos = $iNewPos;
$iNewPos = index($strString, $strChar, $iPos + 1);
}
return substr($strString, 0, $iPos + 1), substr($strString, $iPos + 1);
}
push @EXPORT, qw(stringSplit);
1;

View File

@ -12,13 +12,13 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Version;
use pgBackRestBuild::Config::Data;
use BackRestDoc::Common::DocRender;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
####################################################################################################################################
# XML node constants

View File

@ -10,9 +10,8 @@ use Carp qw(confess);
use Exporter qw(import);
our @EXPORT = qw();
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use BackRestDoc::Html::DocHtmlElement;
####################################################################################################################################

View File

@ -11,7 +11,7 @@ use Exporter qw(import);
our @EXPORT = qw();
use Scalar::Util qw(blessed);
use pgBackRest::Common::Log;
use BackRestDoc::Common::Log;
####################################################################################################################################
# Html Element Types

View File

@ -12,14 +12,13 @@ use Data::Dumper;
use Exporter qw(import);
our @EXPORT = qw();
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::DocConfig;
use BackRestDoc::Common::DocManifest;
use BackRestDoc::Common::DocRender;
use BackRestDoc::Html::DocHtmlBuilder;
use BackRestDoc::Html::DocHtmlElement;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
####################################################################################################################################
# CONSTRUCTOR

View File

@ -16,15 +16,15 @@ use File::Copy;
use POSIX qw(strftime);
use Storable qw(dclone);
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Version;
use pgBackRestTest::Common::ExecuteTest;
use BackRestDoc::Common::DocConfig;
use BackRestDoc::Common::DocManifest;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use BackRestDoc::Html::DocHtmlPage;
####################################################################################################################################

View File

@ -17,11 +17,12 @@ use File::Copy;
use POSIX qw(strftime);
use Storable qw(dclone);
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Version;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestTest::Common::ExecuteTest;
use BackRestDoc::Common::DocConfig;

View File

@ -11,11 +11,10 @@ use Carp qw(confess);
use Exporter qw(import);
our @EXPORT = qw();
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::DocConfig;
use BackRestDoc::Common::DocManifest;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
####################################################################################################################################
# CONSTRUCTOR

View File

@ -15,14 +15,14 @@ use File::Copy;
use POSIX qw(strftime);
use Storable qw(dclone);
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Version;
use pgBackRestTest::Common::ExecuteTest;
use BackRestDoc::Common::DocConfig;
use BackRestDoc::Common::DocManifest;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use BackRestDoc::Markdown::DocMarkdownRender;
####################################################################################################################################

View File

@ -15,11 +15,10 @@ use File::Basename qw(dirname);
use File::Copy;
use Storable qw(dclone);
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::DocConfig;
use BackRestDoc::Common::DocManifest;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
####################################################################################################################################
# CONSTRUCTOR

View File

@ -32,9 +32,9 @@ use BackRestDoc::Html::DocHtmlSite;
use BackRestDoc::Latex::DocLatex;
use BackRestDoc::Markdown::DocMarkdown;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRest::Version;
use pgBackRestTest::Common::ExecuteTest;

View File

@ -1,44 +0,0 @@
####################################################################################################################################
# ARCHIVE COMMON MODULE
####################################################################################################################################
package pgBackRest::Archive::Common;
use strict;
use warnings FATAL => qw(all);
use Carp qw(confess);
use Config;
use Exporter qw(import);
our @EXPORT = qw();
use Fcntl qw(SEEK_CUR O_RDONLY);
use File::Basename qw(dirname);
use pgBackRest::DbVersion;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Common::Wait;
use pgBackRest::Storage::Helper;
####################################################################################################################################
# RegEx constants
####################################################################################################################################
use constant REGEX_ARCHIVE_DIR_DB_VERSION => '^[0-9]+(\.[0-9]+)*-[0-9]+$';
push @EXPORT, qw(REGEX_ARCHIVE_DIR_DB_VERSION);
use constant REGEX_ARCHIVE_DIR_WAL => '^[0-F]{16}$';
push @EXPORT, qw(REGEX_ARCHIVE_DIR_WAL);
####################################################################################################################################
# PostgreSQL WAL system id offset
####################################################################################################################################
use constant PG_WAL_SYSTEM_ID_OFFSET_GTE_93 => 12 + $Config{ptrsize};
push @EXPORT, qw(PG_WAL_SYSTEM_ID_OFFSET_GTE_93);
use constant PG_WAL_SYSTEM_ID_OFFSET_LT_93 => 12;
push @EXPORT, qw(PG_WAL_SYSTEM_ID_OFFSET_LT_93);
####################################################################################################################################
# WAL segment size
####################################################################################################################################
use constant PG_WAL_SEGMENT_SIZE => 16777216;
push @EXPORT, qw(PG_WAL_SEGMENT_SIZE);
1;

View File

@ -1,256 +0,0 @@
####################################################################################################################################
# BACKUP COMMON MODULE
####################################################################################################################################
package pgBackRest::Backup::Common;
use strict;
use warnings FATAL => qw(all);
use Carp qw(confess);
use Exporter qw(import);
our @EXPORT = qw();
use File::Basename;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Common::Wait;
use pgBackRest::Manifest;
use pgBackRest::Storage::Helper;
####################################################################################################################################
# Latest backup link constant
####################################################################################################################################
use constant LINK_LATEST => 'latest';
push @EXPORT, qw(LINK_LATEST);
use constant CFGOPTVAL_BACKUP_TYPE_FULL => 'full';
push @EXPORT, qw(CFGOPTVAL_BACKUP_TYPE_FULL);
use constant CFGOPTVAL_BACKUP_TYPE_DIFF => 'diff';
push @EXPORT, qw(CFGOPTVAL_BACKUP_TYPE_DIFF);
use constant CFGOPTVAL_BACKUP_TYPE_INCR => 'incr';
push @EXPORT, qw(CFGOPTVAL_BACKUP_TYPE_INCR);
####################################################################################################################################
# backupRegExpGet
#
# Generate a regexp depending on the backups that need to be found.
####################################################################################################################################
sub backupRegExpGet
{
# Assign function parameters, defaults, and log debug info
my
(
$strOperation,
$bFull,
$bDifferential,
$bIncremental,
$bAnchor
) =
logDebugParam
(
__PACKAGE__ . '::backupRegExpGet', \@_,
{name => 'bFull', default => false},
{name => 'bDifferential', default => false},
{name => 'bIncremental', default => false},
{name => 'bAnchor', default => true}
);
# One of the types must be selected
if (!($bFull || $bDifferential || $bIncremental))
{
confess &log(ASSERT, 'at least one backup type must be selected');
}
# Standard regexp to match date and time formatting
my $strDateTimeRegExp = "[0-9]{8}\\-[0-9]{6}";
# Start the expression with the anchor if requested, date/time regexp and full backup indicator
my $strRegExp = ($bAnchor ? '^' : '') . $strDateTimeRegExp . 'F';
# Add the diff and/or incr expressions if requested
if ($bDifferential || $bIncremental)
{
# If full requested then diff/incr is optional
if ($bFull)
{
$strRegExp .= "(\\_";
}
# Else diff/incr is required
else
{
$strRegExp .= "\\_";
}
# Append date/time regexp for diff/incr
$strRegExp .= $strDateTimeRegExp;
# Filter on both diff/incr
if ($bDifferential && $bIncremental)
{
$strRegExp .= '(D|I)';
}
# Else just diff
elsif ($bDifferential)
{
$strRegExp .= 'D';
}
# Else just incr
else
{
$strRegExp .= 'I';
}
# If full requested then diff/incr is optional
if ($bFull)
{
$strRegExp .= '){0,1}';
}
}
# Append the end anchor if requested
$strRegExp .= $bAnchor ? "\$" : '';
# Return from function and log return values if any
return logDebugReturn
(
$strOperation,
{name => 'strRegExp', value => $strRegExp}
);
}
push @EXPORT, qw(backupRegExpGet);
####################################################################################################################################
# backupLabelFormat
#
# Format the label for a backup.
####################################################################################################################################
sub backupLabelFormat
{
# Assign function parameters, defaults, and log debug info
my
(
$strOperation,
$strType,
$strBackupLabelLast,
$lTimestampStart
) =
logDebugParam
(
__PACKAGE__ . '::backupLabelFormat', \@_,
{name => 'strType', trace => true},
{name => 'strBackupLabelLast', required => false, trace => true},
{name => 'lTimestampTart', trace => true}
);
# Full backup label
my $strBackupLabel;
if ($strType eq CFGOPTVAL_BACKUP_TYPE_FULL)
{
# Last backup label must not be defined
if (defined($strBackupLabelLast))
{
confess &log(ASSERT, "strBackupLabelLast must not be defined when strType = '${strType}'");
}
# Format the timestamp and add the full indicator
$strBackupLabel = timestampFileFormat(undef, $lTimestampStart) . 'F';
}
# Else diff or incr label
else
{
# Last backup label must be defined
if (!defined($strBackupLabelLast))
{
confess &log(ASSERT, "strBackupLabelLast must be defined when strType = '${strType}'");
}
# Get the full backup portion of the last backup label
$strBackupLabel = substr($strBackupLabelLast, 0, 16);
# Format the timestamp
$strBackupLabel .= '_' . timestampFileFormat(undef, $lTimestampStart);
# Add the diff indicator
if ($strType eq CFGOPTVAL_BACKUP_TYPE_DIFF)
{
$strBackupLabel .= 'D';
}
# Else incr indicator
else
{
$strBackupLabel .= 'I';
}
}
# Return from function and log return values if any
return logDebugReturn
(
$strOperation,
{name => 'strBackupLabel', value => $strBackupLabel, trace => true}
);
}
push @EXPORT, qw(backupLabelFormat);
####################################################################################################################################
# backupLabel
#
# Get unique backup label.
####################################################################################################################################
sub backupLabel
{
# Assign function parameters, defaults, and log debug info
my
(
$strOperation,
$oStorageRepo,
$strRepoBackupPath,
$strType,
$strBackupLabelLast,
$lTimestampStart
) =
logDebugParam
(
__PACKAGE__ . '::backupLabelFormat', \@_,
{name => 'oStorageRepo', trace => true},
{name => 'strRepoBackupPath', trace => true},
{name => 'strType', trace => true},
{name => 'strBackupLabelLast', required => false, trace => true},
{name => 'lTimestampStart', trace => true}
);
# Create backup label
my $strBackupLabel = backupLabelFormat($strType, $strBackupLabelLast, $lTimestampStart);
# Make sure that the timestamp has not already been used by a prior backup. This is unlikely for online backups since there is
# already a wait after the manifest is built but it's still possible if the remote and local systems don't have synchronized
# clocks. In practice this is most useful for making offline testing faster since it allows the wait after manifest build to
# be skipped by dealing with any backup label collisions here.
if ($oStorageRepo->list(
$strRepoBackupPath,
{strExpression =>
($strType eq CFGOPTVAL_BACKUP_TYPE_FULL ? '^' : '_') . timestampFileFormat(undef, $lTimestampStart) .
($strType eq CFGOPTVAL_BACKUP_TYPE_FULL ? 'F' : '(D|I)$')}) ||
$oStorageRepo->list(
"${strRepoBackupPath}/" . PATH_BACKUP_HISTORY . '/' . timestampFormat('%4d', $lTimestampStart),
{strExpression =>
($strType eq CFGOPTVAL_BACKUP_TYPE_FULL ? '^' : '_') . timestampFileFormat(undef, $lTimestampStart) .
($strType eq CFGOPTVAL_BACKUP_TYPE_FULL ? 'F' : '(D|I)\.manifest\.gz$'),
bIgnoreMissing => true}))
{
waitRemainder();
$strBackupLabel = backupLabelFormat($strType, $strBackupLabelLast, time());
}
# Return from function and log return values if any
return logDebugReturn
(
$strOperation,
{name => 'strBackupLabel', value => $strBackupLabel, trace => true}
);
}
push @EXPORT, qw(backupLabel);
1;

View File

@ -1,224 +0,0 @@
####################################################################################################################################
# COMMON STRING MODULE
####################################################################################################################################
package pgBackRest::Common::String;
use strict;
use warnings FATAL => qw(all);
use Carp qw(confess longmess);
use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
####################################################################################################################################
# trim
#
# Trim whitespace.
####################################################################################################################################
sub trim
{
my $strBuffer = shift;
if (!defined($strBuffer))
{
return;
}
$strBuffer =~ s/^\s+|\s+$//g;
return $strBuffer;
}
push @EXPORT, qw(trim);
####################################################################################################################################
# coalesce - return first defined parameter
####################################################################################################################################
sub coalesce
{
foreach my $strParam (@_)
{
if (defined($strParam))
{
return $strParam;
}
}
return;
}
push @EXPORT, qw(coalesce);
####################################################################################################################################
# commonPrefix
#
# Determine how much of two strings is the same from the beginning.
####################################################################################################################################
sub commonPrefix
{
my $strString1 = shift;
my $strString2 = shift;
my $iCommonLen = 0;
my $iCompareLen = length($strString1) < length($strString2) ? length($strString1) : length($strString2);
for (my $iIndex = 0; $iIndex < $iCompareLen; $iIndex++)
{
if (substr($strString1, $iIndex, 1) ne substr($strString2, $iIndex, 1))
{
last;
}
$iCommonLen++;
}
return $iCommonLen;
}
push @EXPORT, qw(commonPrefix);
####################################################################################################################################
# boolFormat
#
# Output boolean as true or false.
####################################################################################################################################
sub boolFormat
{
return shift() ? 'true' : 'false';
}
push @EXPORT, qw(boolFormat);
####################################################################################################################################
# fileSizeFormat
#
# Format file sizes in human-readable form.
####################################################################################################################################
sub fileSizeFormat
{
my $lFileSize = shift;
if ($lFileSize < 1024)
{
return $lFileSize . 'B';
}
if ($lFileSize < (1024 * 1024))
{
return (int($lFileSize / 102.4) / 10) . 'KB';
}
if ($lFileSize < (1024 * 1024 * 1024))
{
return (int($lFileSize / 1024 / 102.4) / 10) . 'MB';
}
return (int($lFileSize / 1024 / 1024 / 102.4) / 10) . 'GB';
}
push @EXPORT, qw(fileSizeFormat);
####################################################################################################################################
# timestampFormat
#
# Get standard timestamp format (or formatted as specified).
####################################################################################################################################
sub timestampFormat
{
my $strFormat = shift;
my $lTime = shift;
if (!defined($strFormat))
{
$strFormat = '%4d-%02d-%02d %02d:%02d:%02d';
}
if (!defined($lTime))
{
$lTime = time();
}
my ($iSecond, $iMinute, $iHour, $iMonthDay, $iMonth, $iYear, $iWeekDay, $iYearDay, $bIsDst) = localtime($lTime);
if ($strFormat eq "%4d")
{
return sprintf($strFormat, $iYear + 1900)
}
else
{
return sprintf($strFormat, $iYear + 1900, $iMonth + 1, $iMonthDay, $iHour, $iMinute, $iSecond);
}
}
push @EXPORT, qw(timestampFormat);
####################################################################################################################################
# timestampFileFormat
####################################################################################################################################
sub timestampFileFormat
{
my $strFormat = shift;
my $lTime = shift;
return timestampFormat(defined($strFormat) ? $strFormat : '%4d%02d%02d-%02d%02d%02d', $lTime);
}
push @EXPORT, qw(timestampFileFormat);
####################################################################################################################################
# stringSplit
####################################################################################################################################
sub stringSplit
{
my $strString = shift;
my $strChar = shift;
my $iLength = shift;
if (length($strString) <= $iLength)
{
return $strString, undef;
}
my $iPos = index($strString, $strChar);
if ($iPos == -1)
{
return $strString, undef;
}
my $iNewPos = $iPos;
while ($iNewPos != -1 && $iNewPos + 1 < $iLength)
{
$iPos = $iNewPos;
$iNewPos = index($strString, $strChar, $iPos + 1);
}
return substr($strString, 0, $iPos + 1), substr($strString, $iPos + 1);
}
push @EXPORT, qw(stringSplit);
####################################################################################################################################
# regexPrefix - return the constant first part of the regex if it has a beginning anchor
#
# This works by scanning the string until the first special regex character is found so escaped characters will not be included.
####################################################################################################################################
sub regexPrefix
{
my $strExpression = shift;
my $strPrefix;
# Only generate prefix if expression is defined and has a beginning anchor
if (defined($strExpression) && $strExpression =~ /^\^/)
{
($strPrefix) = substr($strExpression, 1) =~ /^[^\.\^\$\*\+\-\?\(\)\[\]\{\}\\\|\ ]+/g;
}
return $strPrefix;
}
push @EXPORT, qw(regexPrefix);
1;

View File

@ -1,109 +0,0 @@
####################################################################################################################################
# Repository Storage Helper
####################################################################################################################################
package pgBackRest::Storage::Helper;
use strict;
use warnings FATAL => qw(all);
use Carp qw(confess);
use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(basename);
use pgBackRest::Common::Log;
use pgBackRest::Storage::Storage;
use pgBackRest::Version;
####################################################################################################################################
# Temp file extension
####################################################################################################################################
use constant STORAGE_TEMP_EXT => PROJECT_EXE . '.tmp';
push @EXPORT, qw(STORAGE_TEMP_EXT);
####################################################################################################################################
# Cache storage so it can be retrieved quickly
####################################################################################################################################
my $oRepoStorage;
####################################################################################################################################
# storageRepoCommandSet
####################################################################################################################################
my $strStorageRepoCommand;
my $strStorageRepoType;
sub storageRepoCommandSet
{
# Assign function parameters, defaults, and log debug info
my
(
$strOperation,
$strCommand,
$strStorageType,
) =
logDebugParam
(
__PACKAGE__ . '::storageRepoCommandSet', \@_,
{name => 'strCommand'},
{name => 'strStorageType'},
);
$strStorageRepoCommand = $strCommand;
$strStorageRepoType = $strStorageType;
# Return from function and log return values if any
return logDebugReturn($strOperation);
}
push @EXPORT, qw(storageRepoCommandSet);
####################################################################################################################################
# storageRepo - get repository storage
####################################################################################################################################
sub storageRepo
{
# Assign function parameters, defaults, and log debug info
my
(
$strOperation,
$strStanza,
) =
logDebugParam
(
__PACKAGE__ . '::storageRepo', \@_,
{name => 'strStanza', optional => true, trace => true},
);
# Create storage if not defined
if (!defined($oRepoStorage))
{
$oRepoStorage = new pgBackRest::Storage::Storage($strStorageRepoCommand, $strStorageRepoType, 64 * 1024, 60);
}
# Return from function and log return values if any
return logDebugReturn
(
$strOperation,
{name => 'oStorageRepo', value => $oRepoStorage, trace => true},
);
}
push @EXPORT, qw(storageRepo);
####################################################################################################################################
# Clear the repo storage cache - FOR TESTING ONLY!
####################################################################################################################################
sub storageRepoCacheClear
{
# Assign function parameters, defaults, and log debug info
my ($strOperation) = logDebugParam(__PACKAGE__ . '::storageRepoCacheClear');
undef($oRepoStorage);
# Return from function and log return values if any
return logDebugReturn($strOperation);
}
push @EXPORT, qw(storageRepoCacheClear);
1;

View File

@ -15,8 +15,8 @@ use English '-no_match_vars';
use Exporter qw(import);
our @EXPORT = qw();
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
####################################################################################################################################
# VM hash keywords

View File

@ -14,7 +14,7 @@ use English '-no_match_vars';
use Exporter qw(import);
our @EXPORT = qw();
use pgBackRest::Common::Log;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::ExecuteTest;

View File

@ -18,10 +18,11 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Getopt::Long qw(GetOptions);
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Version;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::VmTest;

View File

@ -15,10 +15,10 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Version;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use BackRestDoc::Html::DocHtmlBuilder;
use BackRestDoc::Html::DocHtmlElement;

View File

@ -1,7 +1,7 @@
####################################################################################################################################
# DB VERSION MODULE
####################################################################################################################################
package pgBackRest::DbVersion;
package pgBackRestTest::Common::DbVersion;
use strict;
use warnings FATAL => qw(all);
@ -10,13 +10,7 @@ use Carp qw(confess);
use Exporter qw(import);
our @EXPORT = qw();
use pgBackRest::Common::Log;
####################################################################################################################################
# Supported page size
####################################################################################################################################
use constant PG_PAGE_SIZE => 8192;
push @EXPORT, qw(PG_PAGE_SIZE);
use BackRestDoc::Common::Log;
####################################################################################################################################
# PostgreSQL version numbers

View File

@ -13,8 +13,8 @@ use Carp qw(confess);
use Exporter qw(import);
our @EXPORT = qw();
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestTest::Common::VmTest;

View File

@ -17,10 +17,11 @@ use IPC::Open3;
use POSIX ':sys_wait_h';
use Symbol 'gensym';
use pgBackRest::Common::Io::Handle;
use pgBackRest::Common::Io::Buffered;
use pgBackRest::Common::Log;
use pgBackRest::Common::Wait;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::Io::Handle;
use pgBackRestTest::Common::Io::Buffered;
use pgBackRestTest::Common::Wait;
####################################################################################################################################
# new
@ -101,11 +102,11 @@ sub begin
$self->{pId} = open3(undef, $self->{hOut}, $self->{hError}, $self->{strCommand});
# Create buffered read object
$self->{oIo} = new pgBackRest::Common::Io::Buffered(new pgBackRest::Common::Io::Handle('exec test', $self->{hOut}), 0, 65536);
$self->{oIo} = new pgBackRestTest::Common::Io::Buffered(new pgBackRestTest::Common::Io::Handle('exec test', $self->{hOut}), 0, 65536);
# Create buffered error object
$self->{oIoError} = new pgBackRest::Common::Io::Buffered(
new pgBackRest::Common::Io::Handle('exec test', $self->{hError}), 0, 65536);
$self->{oIoError} = new pgBackRestTest::Common::Io::Buffered(
new pgBackRestTest::Common::Io::Handle('exec test', $self->{hError}), 0, 65536);
# Record start time and set process timeout
$self->{iProcessTimeout} = 300;

View File

@ -21,23 +21,23 @@ use IPC::Open3;
use POSIX ':sys_wait_h';
use Symbol 'gensym';
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Common::Wait;
use pgBackRest::Manifest;
use pgBackRest::Storage::Base;
use BackRestDoc::Common::Ini;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::HostGroupTest;
use pgBackRestTest::Common::LogTest;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Common::StorageBase;
use pgBackRestTest::Common::VmTest;
use pgBackRestTest::Common::Wait;
use pgBackRestTest::Env::Host::HostBaseTest;
use pgBackRestTest::Env::Host::HostBackupTest;
use pgBackRestTest::Env::Host::HostDbCommonTest;
use pgBackRestTest::Env::Host::HostDbTest;
use pgBackRestTest::Env::Host::HostS3Test;
use pgBackRestTest::Env::Manifest;
####################################################################################################################################
# testLinkCreate

View File

@ -14,8 +14,8 @@ use Cwd qw(abs_path);
use Exporter qw(import);
our @EXPORT = qw();
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestTest::Common::ExecuteTest;

View File

@ -14,8 +14,8 @@ use Cwd qw(abs_path);
use Exporter qw(import);
our @EXPORT = qw();
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestTest::Common::ExecuteTest;

View File

@ -1,7 +1,7 @@
####################################################################################################################################
# Base IO Module
####################################################################################################################################
package pgBackRest::Common::Io::Base;
package pgBackRestTest::Common::Io::Base;
use strict;
use warnings FATAL => qw(all);
@ -12,7 +12,7 @@ use Exporter qw(import);
our @EXPORT = qw();
use Scalar::Util qw(blessed);
use pgBackRest::Common::Log;
use BackRestDoc::Common::Log;
####################################################################################################################################
# Package name constant

View File

@ -1,8 +1,8 @@
####################################################################################################################################
# Buffered Handle IO
####################################################################################################################################
package pgBackRest::Common::Io::Buffered;
use parent 'pgBackRest::Common::Io::Filter';
package pgBackRestTest::Common::Io::Buffered;
use parent 'pgBackRestTest::Common::Io::Filter';
use strict;
use warnings FATAL => qw(all);
@ -14,11 +14,12 @@ use Exporter qw(import);
use IO::Select;
use Time::HiRes qw(gettimeofday);
use pgBackRest::Common::Exception;
use pgBackRest::Common::Io::Base;
use pgBackRest::Common::Io::Handle;
use pgBackRest::Common::Log;
use pgBackRest::Common::Wait;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::Io::Base;
use pgBackRestTest::Common::Io::Handle;
use pgBackRestTest::Common::Wait;
####################################################################################################################################
# Package name constant

View File

@ -1,7 +1,7 @@
####################################################################################################################################
# Base Filter Module
####################################################################################################################################
package pgBackRest::Common::Io::Filter;
package pgBackRestTest::Common::Io::Filter;
use strict;
use warnings FATAL => qw(all);
@ -12,7 +12,7 @@ use Exporter qw(import);
our @EXPORT = qw();
use Scalar::Util qw(blessed);
use pgBackRest::Common::Log;
use BackRestDoc::Common::Log;
####################################################################################################################################
# new

View File

@ -1,8 +1,8 @@
####################################################################################################################################
# Basic Handle IO
####################################################################################################################################
package pgBackRest::Common::Io::Handle;
use parent 'pgBackRest::Common::Io::Base';
package pgBackRestTest::Common::Io::Handle;
use parent 'pgBackRestTest::Common::Io::Base';
use strict;
use warnings FATAL => qw(all);
@ -12,8 +12,8 @@ use English '-no_match_vars';
use Exporter qw(import);
our @EXPORT = qw();
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
####################################################################################################################################
# Package name constant

View File

@ -1,8 +1,8 @@
####################################################################################################################################
# Process Execution, Management, and IO
####################################################################################################################################
package pgBackRest::Common::Io::Process;
use parent 'pgBackRest::Common::Io::Filter';
package pgBackRestTest::Common::Io::Process;
use parent 'pgBackRestTest::Common::Io::Filter';
use strict;
use warnings FATAL => qw(all);
@ -15,10 +15,11 @@ use IPC::Open3 qw(open3);
use POSIX qw(:sys_wait_h);
use Symbol 'gensym';
use pgBackRest::Common::Exception;
use pgBackRest::Common::Io::Buffered;
use pgBackRest::Common::Log;
use pgBackRest::Common::Wait;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::Io::Buffered;
use pgBackRestTest::Common::Wait;
####################################################################################################################################
# Amount of time to attempt to retrieve errors when a process terminates unexpectedly
@ -100,8 +101,8 @@ sub error
# Drain the stderr stream
my $strError;
my $oIoError = new pgBackRest::Common::Io::Buffered(
new pgBackRest::Common::Io::Handle($self->id(), $self->{fhReadError}), 5, $self->bufferMax());
my $oIoError = new pgBackRestTest::Common::Io::Buffered(
new pgBackRestTest::Common::Io::Handle($self->id(), $self->{fhReadError}), 5, $self->bufferMax());
while (defined(my $strLine = $oIoError->readLine(true, false)))
{

View File

@ -18,15 +18,16 @@ use File::Basename qw(dirname basename);
use POSIX qw(ceil);
use Time::HiRes qw(gettimeofday);
use pgBackRest::DbVersion;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Version;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestTest::Common::BuildTest;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::CoverageTest;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::DefineTest;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::ListTest;

View File

@ -13,8 +13,8 @@ use Carp qw(confess);
use Exporter qw(import);
our @EXPORT = qw();
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestTest::Common::DefineTest;
use pgBackRestTest::Common::VmTest;

View File

@ -15,9 +15,10 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
use pgBackRest::Common::Log;
use pgBackRest::Version;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::ExecuteTest;

View File

@ -15,12 +15,12 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Common::Wait;
use pgBackRest::Version;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestTest::Common::BuildTest;
use pgBackRestTest::Common::DefineTest;
use pgBackRestTest::Common::ExecuteTest;
@ -28,6 +28,7 @@ use pgBackRestTest::Common::LogTest;
use pgBackRestTest::Common::Storage;
use pgBackRestTest::Common::StoragePosix;
use pgBackRestTest::Common::VmTest;
use pgBackRestTest::Common::Wait;
####################################################################################################################################
# Constant to use when bogus data is required

View File

@ -2,7 +2,7 @@
# Implements storage functionality using drivers.
####################################################################################################################################
package pgBackRestTest::Common::Storage;
use parent 'pgBackRest::Storage::Base';
use parent 'pgBackRestTest::Common::StorageBase';
use strict;
use warnings FATAL => qw(all);
@ -11,10 +11,11 @@ use English '-no_match_vars';
use File::Basename qw(dirname);
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Storage::Base;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestTest::Common::StorageBase;
####################################################################################################################################
# new

View File

@ -1,7 +1,7 @@
####################################################################################################################################
# Base Storage Module
####################################################################################################################################
package pgBackRest::Storage::Base;
package pgBackRestTest::Common::StorageBase;
use strict;
use warnings FATAL => qw(all);
@ -13,9 +13,10 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
use pgBackRest::Common::Exception;
use pgBackRest::Common::Io::Base;
use pgBackRest::Common::Log;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::Io::Base;
####################################################################################################################################
# Storage constants

View File

@ -16,9 +16,10 @@ use File::Basename qw(basename dirname);
use Fcntl qw(:mode);
use File::stat qw{lstat};
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Storage::Base;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::StorageBase;
use pgBackRestTest::Common::StoragePosixRead;
use pgBackRestTest::Common::StoragePosixWrite;

View File

@ -2,7 +2,7 @@
# Posix File Read
####################################################################################################################################
package pgBackRestTest::Common::StoragePosixRead;
use parent 'pgBackRest::Common::Io::Handle';
use parent 'pgBackRestTest::Common::Io::Handle';
use strict;
use warnings FATAL => qw(all);
@ -11,8 +11,8 @@ use English '-no_match_vars';
use Fcntl qw(O_RDONLY);
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
####################################################################################################################################
# CONSTRUCTOR

View File

@ -2,7 +2,7 @@
# Posix File Write
####################################################################################################################################
package pgBackRestTest::Common::StoragePosixWrite;
use parent 'pgBackRest::Common::Io::Handle';
use parent 'pgBackRestTest::Common::Io::Handle';
use strict;
use warnings FATAL => qw(all);
@ -12,11 +12,11 @@ use English '-no_match_vars';
use Fcntl qw(O_RDONLY O_WRONLY O_CREAT O_TRUNC);
use File::Basename qw(dirname);
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use pgBackRest::Common::Io::Handle;
use pgBackRest::Storage::Base;
use pgBackRestTest::Common::Io::Handle;
use pgBackRestTest::Common::StorageBase;
####################################################################################################################################
# CONSTRUCTOR

View File

@ -1,8 +1,8 @@
####################################################################################################################################
# C Storage Interface
####################################################################################################################################
package pgBackRest::Storage::Storage;
use parent 'pgBackRest::Storage::Base';
package pgBackRestTest::Common::StorageRepo;
use parent 'pgBackRestTest::Common::StorageBase';
use strict;
use warnings FATAL => qw(all);
@ -10,16 +10,27 @@ use Carp qw(confess);
use English '-no_match_vars';
use Digest::SHA qw(sha1_hex);
use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
use Fcntl qw(:mode);
use File::stat qw{lstat};
use JSON::PP;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Io::Handle;
use pgBackRest::Common::Io::Process;
use pgBackRest::Common::Log;
use pgBackRest::Storage::Base;
use pgBackRest::Version;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::Io::Handle;
use pgBackRestTest::Common::Io::Process;
use pgBackRestTest::Common::StorageBase;
####################################################################################################################################
# Temp file extension
####################################################################################################################################
use constant STORAGE_TEMP_EXT => PROJECT_EXE . '.tmp';
push @EXPORT, qw(STORAGE_TEMP_EXT);
####################################################################################################################################
# new
@ -123,9 +134,9 @@ sub exec
);
$strCommand = "$self->{strCommand} ${strCommand}";
my $oBuffer = new pgBackRest::Common::Io::Buffered(
new pgBackRest::Common::Io::Handle($strCommand), $self->{iTimeoutIo}, $self->{lBufferMax});
my $oProcess = new pgBackRest::Common::Io::Process($oBuffer, $strCommand);
my $oBuffer = new pgBackRestTest::Common::Io::Buffered(
new pgBackRestTest::Common::Io::Handle($strCommand), $self->{iTimeoutIo}, $self->{lBufferMax});
my $oProcess = new pgBackRestTest::Common::Io::Process($oBuffer, $strCommand);
my $tResult;
@ -479,9 +490,9 @@ sub put
"$self->{strCommand}" . (defined($strCipherPass) ? ' --cipher-pass=' . $self->escape($strCipherPass) : '') .
($bRaw ? ' --raw' : '') . ' repo-put ' . $self->escape($strFile);
my $oBuffer = new pgBackRest::Common::Io::Buffered(
new pgBackRest::Common::Io::Handle($strCommand), $self->{iTimeoutIo}, $self->{lBufferMax});
my $oProcess = new pgBackRest::Common::Io::Process($oBuffer, $strCommand);
my $oBuffer = new pgBackRestTest::Common::Io::Buffered(
new pgBackRestTest::Common::Io::Handle($strCommand), $self->{iTimeoutIo}, $self->{lBufferMax});
my $oProcess = new pgBackRestTest::Common::Io::Process($oBuffer, $strCommand);
if (defined($tContent))
{
@ -529,6 +540,75 @@ sub remove
return logDebugReturn($strOperation);
}
####################################################################################################################################
# Cache storage so it can be retrieved quickly
####################################################################################################################################
my $oRepoStorage;
####################################################################################################################################
# storageRepoCommandSet
####################################################################################################################################
my $strStorageRepoCommand;
my $strStorageRepoType;
sub storageRepoCommandSet
{
# Assign function parameters, defaults, and log debug info
my
(
$strOperation,
$strCommand,
$strStorageType,
) =
logDebugParam
(
__PACKAGE__ . '::storageRepoCommandSet', \@_,
{name => 'strCommand'},
{name => 'strStorageType'},
);
$strStorageRepoCommand = $strCommand;
$strStorageRepoType = $strStorageType;
# Return from function and log return values if any
return logDebugReturn($strOperation);
}
push @EXPORT, qw(storageRepoCommandSet);
####################################################################################################################################
# storageRepo - get repository storage
####################################################################################################################################
sub storageRepo
{
# Assign function parameters, defaults, and log debug info
my
(
$strOperation,
$strStanza,
) =
logDebugParam
(
__PACKAGE__ . '::storageRepo', \@_,
{name => 'strStanza', optional => true, trace => true},
);
# Create storage if not defined
if (!defined($oRepoStorage))
{
$oRepoStorage = new pgBackRestTest::Common::StorageRepo($strStorageRepoCommand, $strStorageRepoType, 64 * 1024, 60);
}
# Return from function and log return values if any
return logDebugReturn
(
$strOperation,
{name => 'oStorageRepo', value => $oRepoStorage, trace => true},
);
}
push @EXPORT, qw(storageRepo);
####################################################################################################################################
# Getters
####################################################################################################################################

View File

@ -13,9 +13,10 @@ use Carp qw(confess);
use Exporter qw(import);
our @EXPORT = qw();
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::DbVersion;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::DbVersion;
####################################################################################################################################
# VM hash keywords

View File

@ -1,7 +1,7 @@
####################################################################################################################################
# COMMON WAIT MODULE
####################################################################################################################################
package pgBackRest::Common::Wait;
package pgBackRestTest::Common::Wait;
use strict;
use warnings FATAL => qw(all);
@ -13,7 +13,7 @@ use File::Basename qw(dirname);
use POSIX qw(ceil);
use Time::HiRes qw(gettimeofday usleep);
use pgBackRest::Common::Log;
use BackRestDoc::Common::Log;
####################################################################################################################################
# Wait constants

View File

@ -5,8 +5,8 @@
# regarding the stanza database version, database WAL segment system id and other information to ensure that archiving is being
# performed on the proper database.
####################################################################################################################################
package pgBackRest::Archive::Info;
use parent 'pgBackRest::Common::Ini';
package pgBackRestTest::Env::ArchiveInfo;
use parent 'BackRestDoc::Common::Ini';
use strict;
use warnings FATAL => qw(all);
@ -17,15 +17,15 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname basename);
use pgBackRest::Archive::Common;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
use pgBackRest::DbVersion;
use pgBackRest::InfoCommon;
use pgBackRest::Manifest;
use pgBackRest::Storage::Base;
use pgBackRest::Storage::Helper;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Ini;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::StorageBase;
use pgBackRestTest::Common::StorageRepo;
use pgBackRestTest::Env::InfoCommon;
use pgBackRestTest::Env::Manifest;
####################################################################################################################################
# File/path constants
@ -33,6 +33,20 @@ use pgBackRest::Storage::Helper;
use constant ARCHIVE_INFO_FILE => 'archive.info';
push @EXPORT, qw(ARCHIVE_INFO_FILE);
####################################################################################################################################
# RegEx constants
####################################################################################################################################
use constant REGEX_ARCHIVE_DIR_DB_VERSION => '^[0-9]+(\.[0-9]+)*-[0-9]+$';
push @EXPORT, qw(REGEX_ARCHIVE_DIR_DB_VERSION);
use constant REGEX_ARCHIVE_DIR_WAL => '^[0-F]{16}$';
push @EXPORT, qw(REGEX_ARCHIVE_DIR_WAL);
####################################################################################################################################
# WAL segment size
####################################################################################################################################
use constant PG_WAL_SEGMENT_SIZE => 16777216;
push @EXPORT, qw(PG_WAL_SEGMENT_SIZE);
####################################################################################################################################
# Archive info constants
####################################################################################################################################

View File

@ -1,8 +1,8 @@
####################################################################################################################################
# BACKUP INFO MODULE
####################################################################################################################################
package pgBackRest::Backup::Info;
use parent 'pgBackRest::Common::Ini';
package pgBackRestTest::Env::BackupInfo;
use parent 'BackRestDoc::Common::Ini';
use strict;
use warnings FATAL => qw(all);
@ -14,14 +14,24 @@ use Exporter qw(import);
use File::Basename qw(dirname basename);
use File::stat;
use pgBackRest::Archive::Info;
use pgBackRest::Backup::Common;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
use pgBackRest::InfoCommon;
use pgBackRest::Manifest;
use pgBackRest::Storage::Helper;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Ini;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::StorageRepo;
use pgBackRestTest::Env::ArchiveInfo;
use pgBackRestTest::Env::InfoCommon;
use pgBackRestTest::Env::Manifest;
####################################################################################################################################
# Backup type constants
####################################################################################################################################
use constant CFGOPTVAL_BACKUP_TYPE_FULL => 'full';
push @EXPORT, qw(CFGOPTVAL_BACKUP_TYPE_FULL);
use constant CFGOPTVAL_BACKUP_TYPE_DIFF => 'diff';
push @EXPORT, qw(CFGOPTVAL_BACKUP_TYPE_DIFF);
use constant CFGOPTVAL_BACKUP_TYPE_INCR => 'incr';
push @EXPORT, qw(CFGOPTVAL_BACKUP_TYPE_INCR);
####################################################################################################################################
# File/path constants
@ -479,7 +489,7 @@ sub backupArchiveDbHistoryId
my @stryArchiveBackup;
# Build the db list from the history in the backup info and archive info file
my $oArchiveInfo = new pgBackRest::Archive::Info($strPathBackupArchive, true);
my $oArchiveInfo = new pgBackRestTest::Env::ArchiveInfo($strPathBackupArchive, true);
my $hDbListArchive = $oArchiveInfo->dbHistoryList();
my $hDbListBackup = $self->dbHistoryList();
my $iDbHistoryId = undef;

View File

@ -14,22 +14,23 @@ use Carp qw(confess);
use Fcntl qw(O_RDONLY);
use File::Basename qw(basename);
use pgBackRest::Archive::Info;
use pgBackRest::Backup::Common;
use pgBackRest::Backup::Info;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
use pgBackRest::DbVersion;
use pgBackRest::Manifest;
use pgBackRest::Storage::Helper;
use pgBackRest::Version;
use pgBackRestTest::Env::HostEnvTest;
use pgBackRestTest::Env::Host::HostBaseTest;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Ini;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::FileTest;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Common::StorageRepo;
use pgBackRestTest::Env::ArchiveInfo;
use pgBackRestTest::Env::BackupInfo;
use pgBackRestTest::Env::HostEnvTest;
use pgBackRestTest::Env::Host::HostBackupTest;
use pgBackRestTest::Env::Host::HostBaseTest;
use pgBackRestTest::Env::Manifest;
####################################################################################################################################
# new
@ -216,20 +217,20 @@ sub stanzaSet
if (!$bStanzaUpgrade)
{
$oArchiveInfo =
new pgBackRest::Archive::Info($self->{oHostBackup}->repoArchivePath(), false,
new pgBackRestTest::Env::ArchiveInfo($self->{oHostBackup}->repoArchivePath(), false,
{bIgnoreMissing => true, strCipherPassSub => $self->{oHostBackup}->repoEncrypt() ? ENCRYPTION_KEY_ARCHIVE : undef});
$oBackupInfo =
new pgBackRest::Backup::Info($self->{oHostBackup}->repoBackupPath(), false,
new pgBackRestTest::Env::BackupInfo($self->{oHostBackup}->repoBackupPath(), false,
{bIgnoreMissing => true, strCipherPassSub => $self->{oHostBackup}->repoEncrypt() ? ENCRYPTION_KEY_MANIFEST : undef});
}
# Else get the info data from disk
else
{
$oArchiveInfo =
new pgBackRest::Archive::Info($self->{oHostBackup}->repoArchivePath(),
new pgBackRestTest::Env::ArchiveInfo($self->{oHostBackup}->repoArchivePath(),
{strCipherPassSub => $self->{oHostBackup}->repoEncrypt() ? ENCRYPTION_KEY_ARCHIVE : undef});
$oBackupInfo =
new pgBackRest::Backup::Info($self->{oHostBackup}->repoBackupPath(),
new pgBackRestTest::Env::BackupInfo($self->{oHostBackup}->repoBackupPath(),
{strCipherPassSub => $self->{oHostBackup}->repoEncrypt() ? ENCRYPTION_KEY_MANIFEST : undef});
}
@ -384,7 +385,7 @@ sub backupCreate
# Get passphrase (returns undefined if repo not encrypted) to access the manifest
my $strCipherPassManifest =
(new pgBackRest::Backup::Info($self->{oHostBackup}->repoBackupPath()))->cipherPassSub();
(new pgBackRestTest::Env::BackupInfo($self->{oHostBackup}->repoBackupPath()))->cipherPassSub();
my $strCipherPassBackupSet;
# If repo is encrypted then get passphrase for accessing the backup files from the last manifest if it exists provide one
@ -396,7 +397,7 @@ sub backupCreate
my $strManifestFile = "$$oStanza{strBackupClusterPath}/${strBackupLabel}/" . FILE_MANIFEST;
my $oManifest = new pgBackRest::Manifest($strManifestFile, {bLoad => false, strDbVersion => PG_VERSION_93,
my $oManifest = new pgBackRestTest::Env::Manifest($strManifestFile, {bLoad => false, strDbVersion => PG_VERSION_93,
iDbCatalogVersion => $self->dbCatalogVersion(PG_VERSION_93),
strCipherPass => $strCipherPassManifest, strCipherPassSub => $strCipherPassBackupSet});
@ -433,7 +434,7 @@ sub backupCreate
$$oStanza{oManifest} = $oManifest;
# Add the backup to info
my $oBackupInfo = new pgBackRest::Backup::Info($$oStanza{strBackupClusterPath}, false);
my $oBackupInfo = new pgBackRestTest::Env::BackupInfo($$oStanza{strBackupClusterPath}, false);
$oBackupInfo->check($$oStanza{strDbVersion}, $$oStanza{iControlVersion}, $$oStanza{iCatalogVersion}, $$oStanza{ullDbSysId});
$oBackupInfo->add($oManifest);
@ -531,7 +532,7 @@ sub archiveCreate
# Get passphrase (returns undefined if repo not encrypted) to access the archive files
my $strCipherPass =
(new pgBackRest::Archive::Info($self->{oHostBackup}->repoArchivePath()))->cipherPassSub();
(new pgBackRestTest::Env::ArchiveInfo($self->{oHostBackup}->repoArchivePath()))->cipherPassSub();
push(my @stryArchive, $strArchive);

View File

@ -18,25 +18,32 @@ use File::Basename qw(dirname);
use File::stat qw{lstat};
use Storable qw(dclone);
use pgBackRest::Archive::Info;
use pgBackRest::Backup::Common;
use pgBackRest::Backup::Info;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
use pgBackRest::DbVersion;
use pgBackRest::Manifest;
use pgBackRest::Storage::Base;
use pgBackRest::Storage::Helper;
use pgBackRest::Version;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Ini;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::StorageBase;
use pgBackRestTest::Common::StorageRepo;
use pgBackRestTest::Env::ArchiveInfo;
use pgBackRestTest::Env::BackupInfo;
use pgBackRestTest::Env::Host::HostBaseTest;
use pgBackRestTest::Env::Host::HostS3Test;
use pgBackRestTest::Env::Manifest;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::HostGroupTest;
use pgBackRestTest::Common::RunTest;
####################################################################################################################################
# Latest backup link constant
####################################################################################################################################
use constant LINK_LATEST => 'latest';
push @EXPORT, qw(LINK_LATEST);
####################################################################################################################################
# Host defaults
####################################################################################################################################
@ -183,6 +190,93 @@ sub new
);
}
####################################################################################################################################
# timestampFileFormat
####################################################################################################################################
sub timestampFileFormat
{
my $strFormat = shift;
my $lTime = shift;
return timestampFormat(defined($strFormat) ? $strFormat : '%4d%02d%02d-%02d%02d%02d', $lTime);
}
push @EXPORT, qw(timestampFileFormat);
####################################################################################################################################
# backupLabelFormat
#
# Format the label for a backup.
####################################################################################################################################
sub backupLabelFormat
{
# Assign function parameters, defaults, and log debug info
my
(
$strOperation,
$strType,
$strBackupLabelLast,
$lTimestampStart
) =
logDebugParam
(
__PACKAGE__ . '::backupLabelFormat', \@_,
{name => 'strType', trace => true},
{name => 'strBackupLabelLast', required => false, trace => true},
{name => 'lTimestampTart', trace => true}
);
# Full backup label
my $strBackupLabel;
if ($strType eq CFGOPTVAL_BACKUP_TYPE_FULL)
{
# Last backup label must not be defined
if (defined($strBackupLabelLast))
{
confess &log(ASSERT, "strBackupLabelLast must not be defined when strType = '${strType}'");
}
# Format the timestamp and add the full indicator
$strBackupLabel = timestampFileFormat(undef, $lTimestampStart) . 'F';
}
# Else diff or incr label
else
{
# Last backup label must be defined
if (!defined($strBackupLabelLast))
{
confess &log(ASSERT, "strBackupLabelLast must be defined when strType = '${strType}'");
}
# Get the full backup portion of the last backup label
$strBackupLabel = substr($strBackupLabelLast, 0, 16);
# Format the timestamp
$strBackupLabel .= '_' . timestampFileFormat(undef, $lTimestampStart);
# Add the diff indicator
if ($strType eq CFGOPTVAL_BACKUP_TYPE_DIFF)
{
$strBackupLabel .= 'D';
}
# Else incr indicator
else
{
$strBackupLabel .= 'I';
}
}
# Return from function and log return values if any
return logDebugReturn
(
$strOperation,
{name => 'strBackupLabel', value => $strBackupLabel, trace => true}
);
}
push @EXPORT, qw(backupLabelFormat);
####################################################################################################################################
# backupBegin
####################################################################################################################################
@ -485,7 +579,7 @@ sub backupCompare
${$oExpectedManifest}{&MANIFEST_SECTION_BACKUP}{&MANIFEST_KEY_LABEL} = $strBackup;
my $oActualManifest = new pgBackRest::Manifest(
my $oActualManifest = new pgBackRestTest::Env::Manifest(
$self->repoBackupPath("${strBackup}/" . FILE_MANIFEST), {strCipherPass => $self->cipherPassManifest()});
${$oExpectedManifest}{&MANIFEST_SECTION_BACKUP}{&MANIFEST_KEY_TIMESTAMP_START} =
@ -823,7 +917,7 @@ sub stanzaCreate
}
# Get the passphrase for accessing the manifest file
$self->{strCipherPassManifest} = (new pgBackRest::Backup::Info($self->repoBackupPath()))->cipherPassSub();
$self->{strCipherPassManifest} = (new pgBackRestTest::Env::BackupInfo($self->repoBackupPath()))->cipherPassSub();
}
if (storageRepo()->exists('archive/' . $self->stanza() . qw{/} . ARCHIVE_INFO_FILE))
@ -837,7 +931,7 @@ sub stanzaCreate
# Get the passphrase for accessing the archived files
$self->{strCipherPassArchive} =
(new pgBackRest::Archive::Info($self->repoArchivePath()))->cipherPassSub();
(new pgBackRestTest::Env::ArchiveInfo($self->repoArchivePath()))->cipherPassSub();
}
# Return from function and log return values if any
@ -1332,13 +1426,13 @@ sub infoMunge
# If the original file content does not exist then load it
if (!defined($self->{hInfoFile}{$strFileName}))
{
$self->{hInfoFile}{$strFileName} = new pgBackRest::Common::Ini(
$self->{hInfoFile}{$strFileName} = new BackRestDoc::Common::Ini(
storageRepo(), $strFileName,
{strCipherPass => !$bManifest ? undef : $self->cipherPassManifest()});
}
# Make a copy of the original file contents
my $oMungeIni = new pgBackRest::Common::Ini(
my $oMungeIni = new BackRestDoc::Common::Ini(
storageRepo(), $strFileName,
{bLoad => false, strContent => iniRender($self->{hInfoFile}{$strFileName}->{oContent}),
strCipherPass => !$bManifest ? undef : $self->cipherPassManifest()});
@ -1632,7 +1726,7 @@ sub restore
if (!defined($rhExpectedManifest))
{
# Load the manifest from the backup expected to be chosen/processed by restore
my $oExpectedManifest = new pgBackRest::Manifest(
my $oExpectedManifest = new pgBackRestTest::Env::Manifest(
$self->repoBackupPath($strBackupExpected . qw{/} . FILE_MANIFEST),
{strCipherPass => $oHostBackup->cipherPassManifest()});
@ -1742,7 +1836,7 @@ sub restoreCompare
if (defined(${$oExpectedManifestRef}{&MANIFEST_SECTION_BACKUP}{&MANIFEST_KEY_PRIOR}))
{
my $oExpectedManifest =
new pgBackRest::Manifest(
new pgBackRestTest::Env::Manifest(
$self->repoBackupPath(
($strBackup eq 'latest' ? $oHostBackup->backupLast() : $strBackup) . '/' . FILE_MANIFEST),
{strCipherPass => $oHostBackup->cipherPassManifest()});
@ -1752,7 +1846,7 @@ sub restoreCompare
$oExpectedManifest->get(MANIFEST_SECTION_BACKUP_OPTION, &MANIFEST_KEY_DELTA);
$oLastManifest =
new pgBackRest::Manifest(
new pgBackRestTest::Env::Manifest(
$self->repoBackupPath(
${$oExpectedManifestRef}{&MANIFEST_SECTION_BACKUP}{&MANIFEST_KEY_PRIOR} . qw{/} . FILE_MANIFEST),
{strCipherPass => $oHostBackup->cipherPassManifest()});
@ -1807,7 +1901,7 @@ sub restoreCompare
}
}
my $oActualManifest = new pgBackRest::Manifest(
my $oActualManifest = new pgBackRestTest::Env::Manifest(
"${strTestPath}/" . FILE_MANIFEST,
{bLoad => false, strDbVersion => $oExpectedManifestRef->{&MANIFEST_SECTION_BACKUP_DB}{&MANIFEST_KEY_DB_VERSION},
iDbCatalogVersion => $oExpectedManifestRef->{&MANIFEST_SECTION_BACKUP_DB}{&MANIFEST_KEY_CATALOG},

View File

@ -16,14 +16,15 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(dirname);
use pgBackRest::Common::Log;
use pgBackRest::Storage::Helper;
use pgBackRest::Version;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::JobTest;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Common::StorageRepo;
use pgBackRestTest::Common::VmTest;
####################################################################################################################################

View File

@ -16,21 +16,22 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Storable qw(dclone);
use pgBackRest::Common::Exception;
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Common::Wait;
use pgBackRest::DbVersion;
use pgBackRest::Manifest;
use pgBackRest::Storage::Helper;
use pgBackRest::Version;
use pgBackRestTest::Env::Host::HostBackupTest;
use pgBackRestTest::Env::Host::HostBaseTest;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Ini;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::HostGroupTest;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Common::StorageRepo;
use pgBackRestTest::Common::Wait;
use pgBackRestTest::Env::Host::HostBackupTest;
use pgBackRestTest::Env::Host::HostBaseTest;
use pgBackRestTest::Env::Manifest;
####################################################################################################################################
# Test WAL size

View File

@ -17,21 +17,22 @@ use Fcntl ':mode';
use File::Basename qw(basename dirname);
use File::stat;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Common::Wait;
use pgBackRest::DbVersion;
use pgBackRest::Manifest;
use pgBackRest::Storage::Helper;
use pgBackRest::Version;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::FileTest;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Common::StorageRepo;
use pgBackRestTest::Common::Wait;
use pgBackRestTest::Env::Host::HostBackupTest;
use pgBackRestTest::Env::Host::HostBaseTest;
use pgBackRestTest::Env::Host::HostDbCommonTest;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::FileTest;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Env::Manifest;
####################################################################################################################################
# new

View File

@ -16,20 +16,21 @@ use Exporter qw(import);
our @EXPORT = qw();
use File::Basename qw(basename);
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Common::Wait;
use pgBackRest::DbVersion;
use pgBackRest::Manifest;
use pgBackRest::Storage::Helper;
use pgBackRest::Version;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Common::StorageRepo;
use pgBackRestTest::Common::Wait;
use pgBackRestTest::Env::Host::HostBackupTest;
use pgBackRestTest::Env::Host::HostBaseTest;
use pgBackRestTest::Env::Host::HostDbCommonTest;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Env::Manifest;
####################################################################################################################################
# Db defaults

View File

@ -17,20 +17,20 @@ use Exporter qw(import);
use File::Basename qw(dirname);
use Storable qw(dclone);
use pgBackRest::Backup::Common;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
use pgBackRest::Common::Wait;
use pgBackRest::Manifest;
use pgBackRest::Storage::Helper;
use pgBackRest::Version;
use pgBackRestTest::Env::Host::HostBaseTest;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Ini;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::HostGroupTest;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Common::StorageRepo;
use pgBackRestTest::Common::Wait;
use pgBackRestTest::Env::Host::HostBaseTest;
use pgBackRestTest::Env::Manifest;
####################################################################################################################################
# S3 defaults

View File

@ -16,22 +16,22 @@ use Exporter qw(import);
our @EXPORT = qw();
use Storable qw(dclone);
use pgBackRest::Archive::Common;
use pgBackRest::Common::Log;
use pgBackRest::DbVersion;
use pgBackRest::Storage::Base;
use pgBackRest::Storage::Helper;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::HostGroupTest;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Common::StorageBase;
use pgBackRestTest::Common::StorageRepo;
use pgBackRestTest::Env::ArchiveInfo;
use pgBackRestTest::Env::Host::HostBackupTest;
use pgBackRestTest::Env::Host::HostBaseTest;
use pgBackRestTest::Env::Host::HostDbCommonTest;
use pgBackRestTest::Env::Host::HostDbTest;
use pgBackRestTest::Env::Host::HostDbSyntheticTest;
use pgBackRestTest::Env::Host::HostS3Test;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::HostGroupTest;
use pgBackRestTest::Common::RunTest;
####################################################################################################################################
# Constants

View File

@ -2,7 +2,7 @@
# INFO MODULE
# Constants, variables and functions common to the info files
####################################################################################################################################
package pgBackRest::InfoCommon;
package pgBackRestTest::Env::InfoCommon;
use strict;
use warnings FATAL => qw(all);

View File

@ -1,8 +1,8 @@
####################################################################################################################################
# MANIFEST MODULE
####################################################################################################################################
package pgBackRest::Manifest;
use parent 'pgBackRest::Common::Ini';
package pgBackRestTest::Env::Manifest;
use parent 'BackRestDoc::Common::Ini';
use strict;
use warnings FATAL => qw(all);
@ -13,12 +13,13 @@ use Exporter qw(import);
use File::Basename qw(dirname basename);
use Time::Local qw(timelocal);
use pgBackRest::DbVersion;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
use pgBackRest::Common::Wait;
use pgBackRest::Storage::Helper;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Ini;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::StorageRepo;
use pgBackRestTest::Common::Wait;
####################################################################################################################################
# File/path constants

View File

@ -13,27 +13,173 @@ use Carp qw(confess);
use File::Basename qw(basename dirname);
use pgBackRest::Archive::Info;
use pgBackRest::Backup::Common;
use pgBackRest::Backup::Info;
use pgBackRest::DbVersion;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
use pgBackRest::Common::Wait;
use pgBackRest::InfoCommon;
use pgBackRest::Manifest;
use pgBackRest::Storage::Helper;
use pgBackRest::Version;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Ini;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::FileTest;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Common::StorageRepo;
use pgBackRestTest::Common::VmTest;
use pgBackRestTest::Common::Wait;
use pgBackRestTest::Env::ArchiveInfo;
use pgBackRestTest::Env::BackupInfo;
use pgBackRestTest::Env::Host::HostBackupTest;
use pgBackRestTest::Env::Host::HostS3Test;
use pgBackRestTest::Env::HostEnvTest;
use pgBackRestTest::Env::InfoCommon;
use pgBackRestTest::Env::Manifest;
####################################################################################################################################
# backupRegExpGet
#
# Generate a regexp depending on the backups that need to be found.
####################################################################################################################################
sub backupRegExpGet
{
# Assign function parameters, defaults, and log debug info
my
(
$strOperation,
$bFull,
$bDifferential,
$bIncremental,
$bAnchor
) =
logDebugParam
(
__PACKAGE__ . '::backupRegExpGet', \@_,
{name => 'bFull', default => false},
{name => 'bDifferential', default => false},
{name => 'bIncremental', default => false},
{name => 'bAnchor', default => true}
);
# One of the types must be selected
if (!($bFull || $bDifferential || $bIncremental))
{
confess &log(ASSERT, 'at least one backup type must be selected');
}
# Standard regexp to match date and time formatting
my $strDateTimeRegExp = "[0-9]{8}\\-[0-9]{6}";
# Start the expression with the anchor if requested, date/time regexp and full backup indicator
my $strRegExp = ($bAnchor ? '^' : '') . $strDateTimeRegExp . 'F';
# Add the diff and/or incr expressions if requested
if ($bDifferential || $bIncremental)
{
# If full requested then diff/incr is optional
if ($bFull)
{
$strRegExp .= "(\\_";
}
# Else diff/incr is required
else
{
$strRegExp .= "\\_";
}
# Append date/time regexp for diff/incr
$strRegExp .= $strDateTimeRegExp;
# Filter on both diff/incr
if ($bDifferential && $bIncremental)
{
$strRegExp .= '(D|I)';
}
# Else just diff
elsif ($bDifferential)
{
$strRegExp .= 'D';
}
# Else just incr
else
{
$strRegExp .= 'I';
}
# If full requested then diff/incr is optional
if ($bFull)
{
$strRegExp .= '){0,1}';
}
}
# Append the end anchor if requested
$strRegExp .= $bAnchor ? "\$" : '';
# Return from function and log return values if any
return logDebugReturn
(
$strOperation,
{name => 'strRegExp', value => $strRegExp}
);
}
####################################################################################################################################
# backupLabel
#
# Get unique backup label.
####################################################################################################################################
sub backupLabel
{
# Assign function parameters, defaults, and log debug info
my
(
$strOperation,
$oStorageRepo,
$strRepoBackupPath,
$strType,
$strBackupLabelLast,
$lTimestampStart
) =
logDebugParam
(
__PACKAGE__ . '::backupLabelFormat', \@_,
{name => 'oStorageRepo', trace => true},
{name => 'strRepoBackupPath', trace => true},
{name => 'strType', trace => true},
{name => 'strBackupLabelLast', required => false, trace => true},
{name => 'lTimestampStart', trace => true}
);
# Create backup label
my $strBackupLabel = backupLabelFormat($strType, $strBackupLabelLast, $lTimestampStart);
# Make sure that the timestamp has not already been used by a prior backup. This is unlikely for online backups since there is
# already a wait after the manifest is built but it's still possible if the remote and local systems don't have synchronized
# clocks. In practice this is most useful for making offline testing faster since it allows the wait after manifest build to
# be skipped by dealing with any backup label collisions here.
if ($oStorageRepo->list(
$strRepoBackupPath,
{strExpression =>
($strType eq CFGOPTVAL_BACKUP_TYPE_FULL ? '^' : '_') . timestampFileFormat(undef, $lTimestampStart) .
($strType eq CFGOPTVAL_BACKUP_TYPE_FULL ? 'F' : '(D|I)$')}) ||
$oStorageRepo->list(
"${strRepoBackupPath}/" . PATH_BACKUP_HISTORY . '/' . timestampFormat('%4d', $lTimestampStart),
{strExpression =>
($strType eq CFGOPTVAL_BACKUP_TYPE_FULL ? '^' : '_') . timestampFileFormat(undef, $lTimestampStart) .
($strType eq CFGOPTVAL_BACKUP_TYPE_FULL ? 'F' : '(D|I)\.manifest\.gz$'),
bIgnoreMissing => true}))
{
waitRemainder();
$strBackupLabel = backupLabelFormat($strType, $strBackupLabelLast, time());
}
# Return from function and log return values if any
return logDebugReturn
(
$strOperation,
{name => 'strBackupLabel', value => $strBackupLabel, trace => true}
);
}
####################################################################################################################################
# Build PostgreSQL pages for testing

View File

@ -13,21 +13,21 @@ use Carp qw(confess);
use File::Basename qw(dirname);
use pgBackRest::Archive::Info;
use pgBackRest::Backup::Info;
use pgBackRest::DbVersion;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
use pgBackRest::Common::Wait;
use pgBackRest::Manifest;
use pgBackRest::Storage::Helper;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Ini;
use BackRestDoc::Common::Log;
use pgBackRestTest::Env::ArchiveInfo;
use pgBackRestTest::Env::BackupInfo;
use pgBackRestTest::Env::HostEnvTest;
use pgBackRestTest::Env::Host::HostBackupTest;
use pgBackRestTest::Env::Manifest;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Common::StorageRepo;
use pgBackRestTest::Common::VmTest;
use pgBackRestTest::Common::Wait;
####################################################################################################################################
# run

View File

@ -13,21 +13,21 @@ use Carp qw(confess);
use File::Basename qw(dirname);
use pgBackRest::Archive::Info;
use pgBackRest::Backup::Info;
use pgBackRest::DbVersion;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
use pgBackRest::Common::Wait;
use pgBackRest::Manifest;
use pgBackRest::Storage::Helper;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Ini;
use BackRestDoc::Common::Log;
use pgBackRestTest::Env::ArchiveInfo;
use pgBackRestTest::Env::BackupInfo;
use pgBackRestTest::Env::Host::HostBackupTest;
use pgBackRestTest::Env::HostEnvTest;
use pgBackRestTest::Env::Manifest;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Common::StorageRepo;
use pgBackRestTest::Common::VmTest;
use pgBackRestTest::Common::Wait;
####################################################################################################################################
# archiveCheck

View File

@ -14,23 +14,23 @@ use Carp qw(confess);
use File::Basename qw(dirname);
use Storable qw(dclone);
use pgBackRest::Archive::Info;
use pgBackRest::Backup::Info;
use pgBackRest::DbVersion;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
use pgBackRest::Common::Wait;
use pgBackRest::Manifest;
use pgBackRest::Storage::Helper;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Ini;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Common::VmTest;
use pgBackRestTest::Env::ArchiveInfo;
use pgBackRestTest::Env::BackupInfo;
use pgBackRestTest::Env::ExpireEnvTest;
use pgBackRestTest::Env::Host::HostBackupTest;
use pgBackRestTest::Env::Host::HostS3Test;
use pgBackRestTest::Env::HostEnvTest;
use pgBackRestTest::Env::Manifest;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Common::StorageRepo;
use pgBackRestTest::Common::VmTest;
use pgBackRestTest::Common::Wait;
####################################################################################################################################
# run

View File

@ -13,24 +13,24 @@ use Carp qw(confess);
use File::Basename qw(dirname);
use pgBackRest::Archive::Info;
use pgBackRest::Backup::Info;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
use pgBackRest::Common::Wait;
use pgBackRest::DbVersion;
use pgBackRest::InfoCommon;
use pgBackRest::Manifest;
use pgBackRest::Storage::Base;
use pgBackRest::Storage::Helper;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Ini;
use BackRestDoc::Common::Log;
use pgBackRestTest::Env::ArchiveInfo;
use pgBackRestTest::Env::BackupInfo;
use pgBackRestTest::Env::Host::HostBackupTest;
use pgBackRestTest::Env::HostEnvTest;
use pgBackRestTest::Env::InfoCommon;
use pgBackRestTest::Env::Manifest;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::FileTest;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Common::StorageBase;
use pgBackRestTest::Common::StorageRepo;
use pgBackRestTest::Common::VmTest;
use pgBackRestTest::Common::Wait;
####################################################################################################################################
# run
@ -214,8 +214,8 @@ sub run
forceStorageMove(storageRepo(), $strArchiveInfoCopyOldFile, $strArchiveInfoFile, {bRecurse => false});
# Confirm versions
my $oArchiveInfo = new pgBackRest::Archive::Info($oHostBackup->repoArchivePath());
my $oBackupInfo = new pgBackRest::Backup::Info($oHostBackup->repoBackupPath());
my $oArchiveInfo = new pgBackRestTest::Env::ArchiveInfo($oHostBackup->repoArchivePath());
my $oBackupInfo = new pgBackRestTest::Env::BackupInfo($oHostBackup->repoBackupPath());
$self->testResult(sub {$oArchiveInfo->test(INFO_ARCHIVE_SECTION_DB, INFO_ARCHIVE_KEY_DB_VERSION, undef,
PG_VERSION_93)}, true, 'archive at old pg version');
$self->testResult(sub {$oBackupInfo->test(INFO_BACKUP_SECTION_DB, INFO_BACKUP_KEY_DB_VERSION, undef,

View File

@ -15,7 +15,7 @@ use English '-no_match_vars';
use Storable qw(dclone);
use Time::HiRes qw(gettimeofday);
use pgBackRest::Common::Log;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::RunTest;

View File

@ -13,29 +13,31 @@ use Carp qw(confess);
use File::Basename qw(dirname);
use pgBackRest::Archive::Info;
use pgBackRest::Backup::Info;
use pgBackRest::DbVersion;
use pgBackRest::Common::Exception;
use pgBackRest::Common::Ini;
use pgBackRest::Common::Log;
use pgBackRest::Common::Wait;
use pgBackRest::InfoCommon;
use pgBackRest::Manifest;
use pgBackRest::Storage::Helper;
use pgBackRest::Version;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Ini;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::DbVersion;
use pgBackRestTest::Common::ExecuteTest;
use pgBackRestTest::Common::FileTest;
use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Common::VmTest;
use pgBackRestTest::Common::Storage;
use pgBackRestTest::Common::StoragePosix;
use pgBackRestTest::Common::StorageRepo;
use pgBackRestTest::Common::Wait;
use pgBackRestTest::Env::ArchiveInfo;
use pgBackRestTest::Env::BackupInfo;
use pgBackRestTest::Env::InfoCommon;
use pgBackRestTest::Env::Host::HostBaseTest;
use pgBackRestTest::Env::Host::HostBackupTest;
use pgBackRestTest::Env::Host::HostDbTest;
use pgBackRestTest::Env::Host::HostDbTest;
use pgBackRestTest::Env::HostEnvTest;
use pgBackRestTest::Common::Storage;
use pgBackRestTest::Common::StoragePosix;
use pgBackRestTest::Env::Manifest;
####################################################################################################################################
# Backup advisory lock
@ -129,10 +131,10 @@ sub run
# Get passphrase to access the Manifest file from backup.info - returns undefined if repo not encrypted
my $strCipherPass =
(new pgBackRest::Backup::Info($oHostBackup->repoBackupPath()))->cipherPassSub();
(new pgBackRestTest::Env::BackupInfo($oHostBackup->repoBackupPath()))->cipherPassSub();
# Create a manifest with the pg version to get version-specific paths
my $oManifest = new pgBackRest::Manifest(BOGUS, {bLoad => false, strDbVersion => $self->pgVersion(),
my $oManifest = new pgBackRestTest::Env::Manifest(BOGUS, {bLoad => false, strDbVersion => $self->pgVersion(),
iDbCatalogVersion => $self->dbCatalogVersion($self->pgVersion()),
strCipherPass => $strCipherPass, strCipherPassSub => $bRepoEncrypt ? ENCRYPTION_KEY_BACKUPSET : undef});
@ -351,8 +353,8 @@ sub run
# Run stanza-create offline to create files needing to be upgraded (using new pg-path)
$oHostBackup->stanzaCreate('successfully create stanza files to be upgraded',
{strOptionalParam => ' --pg1-path=' . $oHostDbMaster->dbPath() . '/testbase/ --no-online --force'});
my $oArchiveInfo = new pgBackRest::Archive::Info($oHostBackup->repoArchivePath());
my $oBackupInfo = new pgBackRest::Backup::Info($oHostBackup->repoBackupPath());
my $oArchiveInfo = new pgBackRestTest::Env::ArchiveInfo($oHostBackup->repoArchivePath());
my $oBackupInfo = new pgBackRestTest::Env::BackupInfo($oHostBackup->repoBackupPath());
# Read info files to confirm the files were created with a different database version
if ($self->pgVersion() eq PG_VERSION_94)
@ -374,8 +376,8 @@ sub run
$oHostBackup->stanzaUpgrade('upgrade stanza files online');
# Reread the info files and confirm the result
$oArchiveInfo = new pgBackRest::Archive::Info($oHostBackup->repoArchivePath());
$oBackupInfo = new pgBackRest::Backup::Info($oHostBackup->repoBackupPath());
$oArchiveInfo = new pgBackRestTest::Env::ArchiveInfo($oHostBackup->repoArchivePath());
$oBackupInfo = new pgBackRestTest::Env::BackupInfo($oHostBackup->repoBackupPath());
$self->testResult(sub {$oArchiveInfo->test(INFO_ARCHIVE_SECTION_DB, INFO_ARCHIVE_KEY_DB_VERSION, undef,
$self->pgVersion())}, true, 'archive upgrade online corrects db');
$self->testResult(sub {$oBackupInfo->test(INFO_BACKUP_SECTION_DB, INFO_BACKUP_KEY_DB_VERSION, undef,
@ -777,7 +779,7 @@ sub run
else
{
# Backup info will have the catalog number
my $oBackupInfo = new pgBackRest::Common::Ini(
my $oBackupInfo = new BackRestDoc::Common::Ini(
storageRepo(), $oHostBackup->repoBackupPath(FILE_BACKUP_INFO),
{bLoad => false, strContent => ${storageRepo()->get($oHostBackup->repoBackupPath(FILE_BACKUP_INFO))}});

View File

@ -27,12 +27,12 @@ use lib dirname(dirname($0)) . '/lib';
use lib dirname(dirname($0)) . '/build/lib';
use lib dirname(dirname($0)) . '/doc/lib';
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use pgBackRest::Common::String;
use pgBackRest::Common::Wait;
use pgBackRest::Version;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use BackRestDoc::Common::String;
use pgBackRestBuild::Build;
use pgBackRestBuild::Build::Common;
use pgBackRestBuild::Config::Build;
@ -54,6 +54,7 @@ use pgBackRestTest::Common::RunTest;
use pgBackRestTest::Common::Storage;
use pgBackRestTest::Common::StoragePosix;
use pgBackRestTest::Common::VmTest;
use pgBackRestTest::Common::Wait;
####################################################################################################################################
# Usage

View File

@ -21,9 +21,10 @@ use Pod::Usage qw(pod2usage);
use lib dirname($0) . '/lib';
use lib dirname(dirname($0)) . '/lib';
use lib dirname(dirname($0)) . '/doc/lib';
use pgBackRest::Common::Exception;
use pgBackRest::Common::Log;
use BackRestDoc::Common::Exception;
use BackRestDoc::Common::Log;
use pgBackRestTest::Common::ContainerTest;
use pgBackRestTest::Common::ExecuteTest;