mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-02-13 13:59:28 +02:00
Fixed issue #108: Incompatibility with Perl 5.10.1
This commit is contained in:
parent
49f1a3e481
commit
61dfeca3c1
92
README.md
92
README.md
@ -26,7 +26,7 @@ PgBackRest uses the gitflow model of development. This means that the master br
|
||||
|
||||
## Install
|
||||
|
||||
PgBackRest is written entirely in Perl and uses some non-standard modules that must be installed from CPAN.
|
||||
PgBackRest is written entirely in Perl and uses some non-standard modules that must be installed from CPAN. All examples below are for PostgreSQL 9.3 but should be easily adaptable to any recent version.
|
||||
|
||||
### Ubuntu 12.04
|
||||
|
||||
@ -54,9 +54,7 @@ sudo apt-get update
|
||||
|
||||
apt-get install postgresql-9.3
|
||||
```
|
||||
* Perl version 5.12 or greater is required.
|
||||
|
||||
* Install required Perl modules:
|
||||
* Install required Perl modules using CPAN (will be removed in the next release):
|
||||
```
|
||||
cpanm Net::OpenSSH
|
||||
cpanm IPC::System::Simple
|
||||
@ -71,13 +69,95 @@ https://github.com/pgmasters/backrest/releases
|
||||
|
||||
PgBackRest can be installed anywhere but it's best (though not required) to install it in the same location on all systems.
|
||||
|
||||
* Install PostgreSQL development libraries and additional Perl modules for regression tests:
|
||||
* Install PostgreSQL development libraries and additional Perl modules for regression tests (optional):
|
||||
```
|
||||
apt-get install postgresql-server-dev-9.4
|
||||
apt-get install postgresql-server-dev-9.3
|
||||
cpanm DBI
|
||||
cpanm DBD:Pg
|
||||
```
|
||||
|
||||
### CentOS 6
|
||||
|
||||
* Install Perl and required modules:
|
||||
```
|
||||
yum install perl-devel
|
||||
yum install perl-Time-HiRes
|
||||
yum install perl-Compress-Raw-Zlib
|
||||
yum install perl-IO-String
|
||||
yum install perl-parent
|
||||
```
|
||||
* Install additional required Perl modules using CPAN (will be removed in next release):
|
||||
```
|
||||
yum install perl-CPAN
|
||||
curl -L http://cpanmin.us | perl - --sudo App::cpanminus
|
||||
|
||||
cpanm IPC::System::Simple
|
||||
cpanm Net::OpenSSH
|
||||
```
|
||||
For multi-threading you must also update:
|
||||
```
|
||||
yum install gcc
|
||||
cpanm threads
|
||||
cpanm Thread::Queue
|
||||
```
|
||||
* Install PostgreSQL development libraries and additional Perl modules for regression tests (optional):
|
||||
```
|
||||
yum install perl-DBI
|
||||
yum install perl-DBD-Pg
|
||||
```
|
||||
CAVEAT: You must run regression tests with --log-force since file sizes do no currently match up with the test logs.
|
||||
|
||||
* Install the versions of PostgreSQL that you want to test:
|
||||
|
||||
Install package definitions (for each version you need):
|
||||
```
|
||||
sudo rpm -ivh http://yum.postgresql.org/8.4/redhat/rhel-6-x86_64/pgdg-centos-8.4-3.noarch.rpm
|
||||
sudo rpm -ivh http://yum.postgresql.org/9.0/redhat/rhel-6-x86_64/pgdg-centos90-9.0-5.noarch.rpm
|
||||
sudo rpm -ivh http://yum.postgresql.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm
|
||||
sudo rpm -ivh http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-6.noarch.rpm
|
||||
sudo rpm -ivh http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
|
||||
sudo rpm -ivh http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm
|
||||
```
|
||||
|
||||
Install packages (for each version you need):
|
||||
```
|
||||
yum install postgresqlXX-server
|
||||
```
|
||||
CAVEAT: Installing 8.4 with the 9.X series appears to break libpq.
|
||||
|
||||
### Regression Test Setup
|
||||
|
||||
* Create the backrest user
|
||||
|
||||
The backrest user must be created on the same system and in the same group as the user you will use for testing (which can be any user you prefer). For example:
|
||||
```
|
||||
adduser -g <test-user-group> backrest
|
||||
```
|
||||
* Setup password-less SSH login between the test user and the backrest user
|
||||
|
||||
The test user should be able to `ssh backrest@127.0.0.1` and the backrest user should be able to `ssh <testuser>@127.0.0.1` without requiring any passwords. This article (http://archive.oreilly.com/pub/h/66) has details on how to accomplish this. Do the logons both ways at the command line before running regression tests.
|
||||
|
||||
* Give group read and execute permissions to `~/backrest/test`:
|
||||
|
||||
Usually this can be accomplished by running the following as the test user:
|
||||
```
|
||||
chmod 750 ~
|
||||
```
|
||||
* Running regression:
|
||||
|
||||
Running the full regression suite is generally not necessary. Run the following first:
|
||||
```
|
||||
./test.pl --module=backup --module-test=full --db-version=all --thread-max=<# threads>
|
||||
```
|
||||
This will run full backup/restore regression with a variety of options on all installed versions of PostgreSQL. If you are only interested in one version then modify the `db-version` setting to X.X (e.g. 9.4). `--thread-max` can be omitted if you are running single-threaded.
|
||||
|
||||
If there are errors in this test then run full regression to help isolate problems:
|
||||
```
|
||||
./test.pl --db-version=all --thread-max=<# threads>
|
||||
```
|
||||
Report regression test failures at https://github.com/pgmasters/backrest/issues.
|
||||
|
||||
|
||||
## Operation
|
||||
|
||||
### General Options
|
||||
|
@ -13,6 +13,7 @@ use Carp qw(confess);
|
||||
$SIG{__DIE__} = sub { Carp::confess @_ };
|
||||
|
||||
use File::Basename qw(dirname);
|
||||
use Scalar::Util qw(blessed);
|
||||
|
||||
use lib dirname($0) . '/../lib';
|
||||
use BackRest::Backup;
|
||||
@ -326,7 +327,7 @@ if ($@)
|
||||
my $oMessage = $@;
|
||||
|
||||
# If a backrest exception then return the code - don't confess
|
||||
if ($oMessage->isa('BackRest::Exception'))
|
||||
if (blessed($oMessage) && $oMessage->isa('BackRest::Exception'))
|
||||
{
|
||||
safe_exit($oMessage->code());
|
||||
}
|
||||
|
94
doc/doc.xml
94
doc/doc.xml
@ -28,7 +28,7 @@
|
||||
</intro>
|
||||
|
||||
<install title="Install">
|
||||
<text><backrest/> is written entirely in Perl and uses some non-standard modules that must be installed from CPAN.</text>
|
||||
<text><backrest/> is written entirely in Perl and uses some non-standard modules that must be installed from CPAN. All examples below are for <postgres/> 9.3 but should be easily adaptable to any recent version.</text>
|
||||
|
||||
<install-system-list>
|
||||
<install-system title="Ubuntu 12.04">
|
||||
@ -56,9 +56,7 @@
|
||||
|
||||
apt-get install postgresql-9.3
|
||||
</code-block>
|
||||
* Perl version 5.12 or greater is required.
|
||||
|
||||
* Install required Perl modules:
|
||||
* Install required Perl modules using CPAN (will be removed in the next release):
|
||||
<code-block>
|
||||
cpanm Net::OpenSSH
|
||||
cpanm IPC::System::Simple
|
||||
@ -73,12 +71,94 @@
|
||||
|
||||
<backrest/> can be installed anywhere but it's best (though not required) to install it in the same location on all systems.
|
||||
|
||||
* Install <postgres/> development libraries and additional Perl modules for regression tests:
|
||||
* Install <postgres/> development libraries and additional Perl modules for regression tests (optional):
|
||||
<code-block>
|
||||
apt-get install postgresql-server-dev-9.4
|
||||
apt-get install postgresql-server-dev-9.3
|
||||
cpanm DBI
|
||||
cpanm DBD:Pg
|
||||
</code-block></text>
|
||||
</code-block></text>
|
||||
</install-system>
|
||||
|
||||
<install-system title="CentOS 6">
|
||||
<text>* Install Perl and required modules:
|
||||
<code-block>
|
||||
yum install perl-devel
|
||||
yum install perl-Time-HiRes
|
||||
yum install perl-Compress-Raw-Zlib
|
||||
yum install perl-IO-String
|
||||
yum install perl-parent
|
||||
</code-block>
|
||||
* Install additional required Perl modules using CPAN (will be removed in next release):
|
||||
<code-block>
|
||||
yum install perl-CPAN
|
||||
curl -L http://cpanmin.us | perl - --sudo App::cpanminus
|
||||
|
||||
cpanm IPC::System::Simple
|
||||
cpanm Net::OpenSSH
|
||||
</code-block>
|
||||
For multi-threading you must also update:
|
||||
<code-block>
|
||||
yum install gcc
|
||||
cpanm threads
|
||||
cpanm Thread::Queue
|
||||
</code-block>
|
||||
* Install <postgres/> development libraries and additional Perl modules for regression tests (optional):
|
||||
<code-block>
|
||||
yum install perl-DBI
|
||||
yum install perl-DBD-Pg
|
||||
</code-block>
|
||||
CAVEAT: You must run regression tests with --log-force since file sizes do no currently match up with the test logs.
|
||||
|
||||
* Install the versions of PostgreSQL that you want to test:
|
||||
|
||||
Install package definitions (for each version you need):
|
||||
<code-block>
|
||||
sudo rpm -ivh http://yum.postgresql.org/8.4/redhat/rhel-6-x86_64/pgdg-centos-8.4-3.noarch.rpm
|
||||
sudo rpm -ivh http://yum.postgresql.org/9.0/redhat/rhel-6-x86_64/pgdg-centos90-9.0-5.noarch.rpm
|
||||
sudo rpm -ivh http://yum.postgresql.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm
|
||||
sudo rpm -ivh http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-6.noarch.rpm
|
||||
sudo rpm -ivh http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
|
||||
sudo rpm -ivh http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm
|
||||
</code-block>
|
||||
|
||||
Install packages (for each version you need):
|
||||
<code-block>
|
||||
yum install postgresqlXX-server
|
||||
</code-block>
|
||||
CAVEAT: Installing 8.4 with the 9.X series appears to break libpq.</text>
|
||||
</install-system>
|
||||
|
||||
<install-system title="Regression Test Setup">
|
||||
<text>* Create the backrest user
|
||||
|
||||
The backrest user must be created on the same system and in the same group as the user you will use for testing (which can be any user you prefer). For example:
|
||||
<code-block>
|
||||
adduser -g <test-user-group> backrest
|
||||
</code-block>
|
||||
* Setup password-less SSH login between the test user and the backrest user
|
||||
|
||||
The test user should be able to `ssh backrest@127.0.0.1` and the backrest user should be able to `ssh <testuser>@127.0.0.1` without requiring any passwords. This article (http://archive.oreilly.com/pub/h/66) has details on how to accomplish this. Do the logons both ways at the command line before running regression tests.
|
||||
|
||||
* Give group read and execute permissions to <path>~/backrest/test</path>:
|
||||
|
||||
Usually this can be accomplished by running the following as the test user:
|
||||
<code-block>
|
||||
chmod 750 ~
|
||||
</code-block>
|
||||
* Running regression:
|
||||
|
||||
Running the full regression suite is generally not necessary. Run the following first:
|
||||
<code-block>
|
||||
./test.pl --module=backup --module-test=full --db-version=all --thread-max=<# threads>
|
||||
</code-block>
|
||||
This will run full backup/restore regression with a variety of options on all installed versions of <postgres/>. If you are only interested in one version then modify the <setting>db-version</setting> setting to X.X (e.g. 9.4). <setting>--thread-max</setting> can be omitted if you are running single-threaded.
|
||||
|
||||
If there are errors in this test then run full regression to help isolate problems:
|
||||
<code-block>
|
||||
./test.pl --db-version=all --thread-max=<# threads>
|
||||
</code-block>
|
||||
Report regression test failures at https://github.com/pgmasters/backrest/issues.
|
||||
</text>
|
||||
</install-system>
|
||||
</install-system-list>
|
||||
</install>
|
||||
|
@ -632,7 +632,7 @@ sub xfer
|
||||
my $lFileSize = 0;
|
||||
my $lFileTotal = 0;
|
||||
|
||||
foreach my $strFile (sort(keys $oManifestHash{name}))
|
||||
foreach my $strFile (sort(keys(%{$oManifestHash{name}})))
|
||||
{
|
||||
if ($strFile =~ "^[0-F]{24}(-[0-f]{40})(\\.$oFile->{strCompressExtension}){0,1}\$" ||
|
||||
$strFile =~ /^[0-F]{8}\.history$/ || $strFile =~ /^[0-F]{24}\.[0-F]{8}\.backup$/)
|
||||
|
@ -112,7 +112,7 @@ sub backup_file_not_in_manifest
|
||||
|
||||
my @stryFile;
|
||||
|
||||
foreach my $strName (sort(keys $oFileHash{name}))
|
||||
foreach my $strName (sort(keys(%{$oFileHash{name}})))
|
||||
{
|
||||
# Ignore certain files that will never be in the manifest
|
||||
if ($strName eq FILE_MANIFEST ||
|
||||
@ -418,7 +418,7 @@ sub backup_file
|
||||
$oyBackupQueue[@oyBackupQueue] = Thread::Queue->new();
|
||||
}
|
||||
|
||||
foreach my $strFileKey (sort {$b cmp $a} (keys $oFileCopyMap{$strPathKey}))
|
||||
foreach my $strFileKey (sort {$b cmp $a} (keys(%{$oFileCopyMap{$strPathKey}})))
|
||||
{
|
||||
my $oFileCopy = $oFileCopyMap{$strPathKey}{$strFileKey};
|
||||
|
||||
|
@ -311,7 +311,7 @@ sub backupAdd
|
||||
|
||||
if (!$oBackupManifest->test(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_TYPE, undef, BACKUP_TYPE_FULL))
|
||||
{
|
||||
my @stryReference = sort(keys($oReferenceHash));
|
||||
my @stryReference = sort(keys(%$oReferenceHash));
|
||||
|
||||
$self->set(INFO_BACKUP_SECTION_BACKUP_CURRENT, $strBackupLabel, INFO_BACKUP_KEY_PRIOR,
|
||||
$oBackupManifest->get(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_PRIOR));
|
||||
|
@ -1495,7 +1495,7 @@ sub optionValid
|
||||
{
|
||||
my @oyValue;
|
||||
|
||||
foreach my $strValue (sort(keys($$oDepend{&OPTION_RULE_DEPEND_LIST})))
|
||||
foreach my $strValue (sort(keys(%{$$oDepend{&OPTION_RULE_DEPEND_LIST}})))
|
||||
{
|
||||
push(@oyValue, "'${strValue}'");
|
||||
}
|
||||
|
@ -57,13 +57,10 @@ sub new
|
||||
# Connect SSH object if db host is defined
|
||||
if ($self->{bStartStop} && defined($self->{strDbHost}) && !defined($self->{oDbSSH}))
|
||||
{
|
||||
my $strOptionSSHRequestTTY = 'RequestTTY=yes';
|
||||
|
||||
&log(TRACE, "connecting to database ssh host $self->{strDbHost}");
|
||||
|
||||
# !!! This could be improved by redirecting stderr to a file to get a better error message
|
||||
$self->{oDbSSH} = Net::OpenSSH->new($self->{strDbHost}, user => $self->{strDbUser},
|
||||
master_opts => [-o => $strOptionSSHRequestTTY]);
|
||||
$self->{oDbSSH} = Net::OpenSSH->new($self->{strDbHost}, user => $self->{strDbUser});
|
||||
$self->{oDbSSH}->error and confess &log(ERROR, "unable to connect to $self->{strDbHost}: " . $self->{oDbSSH}->error);
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ use File::Path qw(make_path remove_tree);
|
||||
use File::stat;
|
||||
use IO::Handle;
|
||||
use Net::OpenSSH;
|
||||
use Scalar::Util qw(blessed);
|
||||
|
||||
use lib dirname($0) . '/../lib';
|
||||
use BackRest::Config;
|
||||
@ -1643,7 +1644,7 @@ sub copy
|
||||
|
||||
# We'll ignore this error if the source file was missing and missing file exception was returned
|
||||
# and bIgnoreMissingSource is set
|
||||
if ($bIgnoreMissingSource && $strRemote eq 'in' && $oMessage->isa('BackRest::Exception') &&
|
||||
if ($bIgnoreMissingSource && $strRemote eq 'in' && blessed($oMessage) && $oMessage->isa('BackRest::Exception') &&
|
||||
$oMessage->code() == COMMAND_ERR_FILE_MISSING)
|
||||
{
|
||||
close($hDestinationFile) or confess &log(ERROR, "cannot close file ${strDestinationTmpOp}");
|
||||
|
@ -220,7 +220,7 @@ sub iniSave
|
||||
$bRelaxed = defined($bRelaxed) ? $bRelaxed : false;
|
||||
|
||||
# Write the INI file
|
||||
foreach my $strSection (sort(keys $oContent))
|
||||
foreach my $strSection (sort(keys(%$oContent)))
|
||||
{
|
||||
# Add a linefeed between sections
|
||||
if (!$bFirst)
|
||||
@ -246,7 +246,7 @@ sub iniSave
|
||||
or confess "unable to write section ${strSection}: $!";
|
||||
|
||||
# Iterate through all keys in the section
|
||||
foreach my $strKey (sort(keys ${$oContent}{"${strSection}"}))
|
||||
foreach my $strKey (sort(keys(%{${$oContent}{"${strSection}"}})))
|
||||
{
|
||||
# Skip comments
|
||||
if ($strKey eq INI_COMMENT)
|
||||
@ -295,7 +295,7 @@ sub hash
|
||||
# Caculate the checksum
|
||||
my $oChecksumContent = dclone($self->{oContent});
|
||||
|
||||
foreach my $strSection (keys($oChecksumContent))
|
||||
foreach my $strSection (keys(%$oChecksumContent))
|
||||
{
|
||||
delete(${$oChecksumContent}{$strSection}{&INI_COMMENT});
|
||||
}
|
||||
@ -527,14 +527,14 @@ sub keys
|
||||
{
|
||||
if ($self->test($strSection, $strKey))
|
||||
{
|
||||
return sort(keys $self->get($strSection, $strKey));
|
||||
return sort(keys(%{$self->get($strSection, $strKey)}));
|
||||
}
|
||||
|
||||
my @stryEmptyArray;
|
||||
return @stryEmptyArray;
|
||||
}
|
||||
|
||||
return sort(keys $self->{oContent});
|
||||
return sort(keys(%{$self->{oContent}}));
|
||||
}
|
||||
|
||||
####################################################################################################################################
|
||||
|
@ -375,7 +375,7 @@ sub build
|
||||
my %oTablespaceManifestHash;
|
||||
$oFile->manifest(PATH_DB_ABSOLUTE, $strDbClusterPath . '/' . PATH_PG_TBLSPC, \%oTablespaceManifestHash);
|
||||
|
||||
foreach my $strName (sort(CORE::keys $oTablespaceManifestHash{name}))
|
||||
foreach my $strName (sort(CORE::keys(%{$oTablespaceManifestHash{name}})))
|
||||
{
|
||||
if ($strName eq '.' or $strName eq '..')
|
||||
{
|
||||
@ -401,7 +401,7 @@ sub build
|
||||
$self->set(MANIFEST_SECTION_BACKUP_PATH, $strLevel, MANIFEST_SUBKEY_PATH, $strDbClusterPath);
|
||||
|
||||
# Loop though all paths/files/links in the manifest
|
||||
foreach my $strName (sort(CORE::keys $oManifestHash{name}))
|
||||
foreach my $strName (sort(CORE::keys(%{$oManifestHash{name}})))
|
||||
{
|
||||
# Skip certain files during backup
|
||||
if (($strName =~ /^pg\_xlog\/.*/ && !$bNoStartStop) || # pg_xlog/ - this will be reconstructed
|
||||
|
@ -111,14 +111,13 @@ sub new
|
||||
$self->{strCommand} = $strCommand . ' remote';
|
||||
|
||||
# Set SSH Options
|
||||
my $strOptionSSHRequestTTY = 'RequestTTY=yes';
|
||||
my $strOptionSSHCompression = 'Compression=no';
|
||||
|
||||
&log(TRACE, 'connecting to remote ssh host ' . $self->{strHost});
|
||||
|
||||
# Make SSH connection
|
||||
$self->{oSSH} = Net::OpenSSH->new($self->{strHost}, timeout => 600, user => $self->{strUser},
|
||||
master_opts => [-o => $strOptionSSHCompression, -o => $strOptionSSHRequestTTY]);
|
||||
master_opts => [-o => $strOptionSSHCompression]);
|
||||
|
||||
$self->{oSSH}->error and confess &log(ERROR, "unable to connect to $self->{strHost}: " . $self->{oSSH}->error,
|
||||
ERROR_HOST_CONNECT);
|
||||
@ -1082,7 +1081,7 @@ sub command_param_string
|
||||
|
||||
if (defined($oParamHashRef))
|
||||
{
|
||||
foreach my $strParam (sort(keys $oParamHashRef))
|
||||
foreach my $strParam (sort(keys(%$oParamHashRef)))
|
||||
{
|
||||
$strParamList .= (defined($strParamList) ? ',' : '') . "${strParam}=" .
|
||||
(defined(${$oParamHashRef}{"${strParam}"}) ? ${$oParamHashRef}{"${strParam}"} : '[undef]');
|
||||
@ -1162,7 +1161,7 @@ sub command_write
|
||||
{
|
||||
$strOutput = "${strCommand}:\n";
|
||||
|
||||
foreach my $strParam (sort(keys $oParamRef))
|
||||
foreach my $strParam (sort(keys(%$oParamRef)))
|
||||
{
|
||||
if ($strParam =~ /=/)
|
||||
{
|
||||
|
@ -220,7 +220,7 @@ sub process
|
||||
|
||||
my $strOutput = "name\ttype\tuser\tgroup\tmode\tmodification_time\tinode\tsize\tlink_destination";
|
||||
|
||||
foreach my $strName (sort(keys $oManifestHash{name}))
|
||||
foreach my $strName (sort(keys(%{$oManifestHash{name}})))
|
||||
{
|
||||
$strOutput .= "\n${strName}\t" .
|
||||
$oManifestHash{name}{"${strName}"}{type} . "\t" .
|
||||
|
@ -157,7 +157,7 @@ sub manifest_ownership_check
|
||||
# Output warning for any invalid owners
|
||||
if (defined($oOwnerHash{$strOwnerType}))
|
||||
{
|
||||
foreach my $strOwner (sort (keys $oOwnerHash{$strOwnerType}))
|
||||
foreach my $strOwner (sort (keys(%{$oOwnerHash{$strOwnerType}})))
|
||||
{
|
||||
if (!$oOwnerHash{$strOwnerType}{$strOwner})
|
||||
{
|
||||
@ -241,7 +241,7 @@ sub manifest_load
|
||||
# If tablespaces have been remapped, update the manifest
|
||||
elsif (defined($self->{oRemapRef}))
|
||||
{
|
||||
foreach my $strTablespaceKey (sort(keys $self->{oRemapRef}))
|
||||
foreach my $strTablespaceKey (sort(keys(%{$self->{oRemapRef}})))
|
||||
{
|
||||
my $strRemapPath = ${$self->{oRemapRef}}{$strTablespaceKey};
|
||||
my $strPathKey = "tablespace/${strTablespaceKey}";
|
||||
@ -301,7 +301,7 @@ sub clean
|
||||
my %oPathManifest;
|
||||
$self->{oFile}->manifest(PATH_DB_ABSOLUTE, $strPath, \%oPathManifest);
|
||||
|
||||
foreach my $strName (sort {$b cmp $a} (keys $oPathManifest{name}))
|
||||
foreach my $strName (sort {$b cmp $a} (keys(%{$oPathManifest{name}})))
|
||||
{
|
||||
# Skip the root path
|
||||
if ($strName eq '.')
|
||||
@ -519,7 +519,7 @@ sub recovery
|
||||
|
||||
if (defined($self->{oRecoveryRef}))
|
||||
{
|
||||
foreach my $strKey (sort(keys $self->{oRecoveryRef}))
|
||||
foreach my $strKey (sort(keys(%{$self->{oRecoveryRef}})))
|
||||
{
|
||||
my $strPgKey = $strKey;
|
||||
$strPgKey =~ s/\-/\_/g;
|
||||
@ -671,7 +671,7 @@ sub restore
|
||||
{
|
||||
push(@oyRestoreQueue, Thread::Queue->new());
|
||||
|
||||
foreach my $strFileKey (sort {$b cmp $a} (keys $oRestoreHash{$strPathKey}))
|
||||
foreach my $strFileKey (sort {$b cmp $a} (keys(%{$oRestoreHash{$strPathKey}})))
|
||||
{
|
||||
$oyRestoreQueue[@oyRestoreQueue - 1]->enqueue($oRestoreHash{$strPathKey}{$strFileKey});
|
||||
}
|
||||
@ -706,7 +706,7 @@ sub restore
|
||||
# Restore file in main process
|
||||
foreach my $strPathKey (sort (keys %oRestoreHash))
|
||||
{
|
||||
foreach my $strFileKey (sort {$b cmp $a} (keys $oRestoreHash{$strPathKey}))
|
||||
foreach my $strFileKey (sort {$b cmp $a} (keys(%{$oRestoreHash{$strPathKey}})))
|
||||
{
|
||||
$lSizeCurrent = restoreFile($oRestoreHash{$strPathKey}{$strFileKey}, $lCopyTimeBegin, $self->{bDelta},
|
||||
$self->{bForce}, $self->{strBackupPath}, $bSourceCompression, $strCurrentUser,
|
||||
|
@ -444,7 +444,7 @@ sub logDebug
|
||||
{
|
||||
my $strParamSet;
|
||||
|
||||
foreach my $strParam (sort(keys($oParamHash)))
|
||||
foreach my $strParam (sort(keys(%$oParamHash)))
|
||||
{
|
||||
if (defined($strParamSet))
|
||||
{
|
||||
|
@ -761,7 +761,7 @@ sub BackRestTestBackup_ManifestReference
|
||||
}
|
||||
|
||||
# Find all file sections
|
||||
foreach my $strSectionFile (sort(keys $oManifestRef))
|
||||
foreach my $strSectionFile (sort(keys(%$oManifestRef)))
|
||||
{
|
||||
# Skip non-file sections
|
||||
if ($strSectionFile !~ /\:file$/)
|
||||
@ -769,7 +769,7 @@ sub BackRestTestBackup_ManifestReference
|
||||
next;
|
||||
}
|
||||
|
||||
foreach my $strFile (sort(keys ${$oManifestRef}{$strSectionFile}))
|
||||
foreach my $strFile (sort(keys(%{${$oManifestRef}{$strSectionFile}})))
|
||||
{
|
||||
if (!defined($strReference))
|
||||
{
|
||||
@ -1311,7 +1311,7 @@ sub BackRestTestBackup_RestoreCompare
|
||||
|
||||
if (!$bSynthetic)
|
||||
{
|
||||
foreach my $strTablespaceName (keys(${$oExpectedManifestRef}{&MANIFEST_SECTION_BACKUP_PATH}))
|
||||
foreach my $strTablespaceName (keys(%{${$oExpectedManifestRef}{&MANIFEST_SECTION_BACKUP_PATH}}))
|
||||
{
|
||||
if (defined(${$oExpectedManifestRef}{&MANIFEST_SECTION_BACKUP_PATH}{$strTablespaceName}{&MANIFEST_SUBKEY_LINK}))
|
||||
{
|
||||
|
@ -965,7 +965,7 @@ sub BackRestTestCommon_ConfigRemap
|
||||
# Rewrite remap section
|
||||
delete($oConfig{"${strStanza}:restore:tablespace-map"});
|
||||
|
||||
foreach my $strRemap (sort(keys $oRemapHashRef))
|
||||
foreach my $strRemap (sort(keys(%$oRemapHashRef)))
|
||||
{
|
||||
my $strRemapPath = ${$oRemapHashRef}{$strRemap};
|
||||
|
||||
@ -1028,7 +1028,7 @@ sub BackRestTestCommon_ConfigRecovery
|
||||
# Rewrite remap section
|
||||
delete($oConfig{"${strStanza}:restore:recovery-setting"});
|
||||
|
||||
foreach my $strOption (sort(keys $oRecoveryHashRef))
|
||||
foreach my $strOption (sort(keys(%$oRecoveryHashRef)))
|
||||
{
|
||||
$oConfig{"${strStanza}:restore:recovery-setting"}{$strOption} = ${$oRecoveryHashRef}{$strOption};
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ sub argvWriteTest
|
||||
|
||||
if (defined($$oOption{boolean}))
|
||||
{
|
||||
foreach my $strKey (keys $$oOption{boolean})
|
||||
foreach my $strKey (keys(%{$$oOption{boolean}}))
|
||||
{
|
||||
if ($$oOption{boolean}{$strKey})
|
||||
{
|
||||
@ -86,7 +86,7 @@ sub argvWriteTest
|
||||
|
||||
if (defined($$oOption{option}))
|
||||
{
|
||||
foreach my $strKey (keys $$oOption{option})
|
||||
foreach my $strKey (keys(%{$$oOption{option}}))
|
||||
{
|
||||
$ARGV[@ARGV] = "--${strKey}=$$oOption{option}{$strKey}";
|
||||
}
|
||||
|
@ -11,13 +11,13 @@ use strict;
|
||||
use warnings FATAL => qw(all);
|
||||
use Carp qw(confess);
|
||||
|
||||
use Cwd 'abs_path';
|
||||
use Cwd qw(abs_path);
|
||||
use Exporter qw(import);
|
||||
use Fcntl ':mode';
|
||||
use Fcntl qw(:mode);
|
||||
use File::Basename;
|
||||
use File::stat;
|
||||
use POSIX qw(ceil);
|
||||
use Scalar::Util 'blessed';
|
||||
use Scalar::Util qw(blessed);
|
||||
use Time::HiRes qw(gettimeofday usleep);
|
||||
|
||||
use lib dirname($0) . '/../lib';
|
||||
@ -578,7 +578,7 @@ sub BackRestTestFile_Test
|
||||
my $strManifest;
|
||||
|
||||
# Validate the manifest
|
||||
foreach my $strName (sort(keys $oManifestHash{name}))
|
||||
foreach my $strName (sort(keys(%{$oManifestHash{name}})))
|
||||
{
|
||||
if (!defined($strManifest))
|
||||
{
|
||||
|
@ -16,6 +16,7 @@ use File::Basename;
|
||||
use Getopt::Long;
|
||||
use Cwd 'abs_path';
|
||||
use Pod::Usage;
|
||||
use Scalar::Util qw(blessed);
|
||||
#use Test::More;
|
||||
|
||||
use lib dirname($0) . '/../lib';
|
||||
@ -156,7 +157,7 @@ my $strVersionSupport = versionSupport();
|
||||
|
||||
if (!defined($strPgSqlBin))
|
||||
{
|
||||
my @strySearchPath = ('/usr/lib/postgresql/VERSION/bin', '/Library/PostgreSQL/VERSION/bin');
|
||||
my @strySearchPath = ('/usr/lib/postgresql/VERSION/bin', '/usr/pgsql-VERSION/bin', '/Library/PostgreSQL/VERSION/bin');
|
||||
|
||||
foreach my $strSearchPath (@strySearchPath)
|
||||
{
|
||||
@ -178,7 +179,7 @@ if (!defined($strPgSqlBin))
|
||||
}
|
||||
|
||||
# Make sure at least one version of postgres was found
|
||||
@{$strVersionSupport} > 0
|
||||
@stryTestVersion > 0
|
||||
or confess 'pgsql-bin was not defined and postgres could not be located automatically';
|
||||
}
|
||||
else
|
||||
@ -307,9 +308,8 @@ if ($@)
|
||||
my $oMessage = $@;
|
||||
|
||||
# If a backrest exception then return the code - don't confess
|
||||
if ($oMessage->isa('BackRest::Exception'))
|
||||
if (blessed($oMessage) && $oMessage->isa('BackRest::Exception'))
|
||||
{
|
||||
# syswrite(*STDOUT, $oMessage->message() . "\n");
|
||||
syswrite(*STDOUT, $oMessage->trace());
|
||||
exit $oMessage->code();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user