pgbackrest.git / summary / log / commit / refs
commit 187fdaf49bd1d9abb1805e28afc2fab9161bc405
Author: David Steele <github@thelabyrinth.net>
Date: Mon Feb 17 00:01:06 2014 +0000
Better compression choices.
pg_backrest_file.pm | 39 +++++++++++++++++++++++++--------------
1 file changed, 25 insertions(+), 14 deletions(-)
diff --git a/pg_backrest_file.pm b/pg_backrest_file.pm
index 3a4c108ef..73f8d98e3 100644
--- a/pg_backrest_file.pm
+++ b/pg_backrest_file.pm
@@ -62,24 +62,35 @@ sub BUILD
# Create the backup cluster path
$self->{strBackupClusterPath} = $self->{strBackupPath} . "/" . $self->{strStanza};
- # Connect SSH object if backup host is defined
- if (defined($self->{strBackupHost}))
+ # Create the ssh options string
+ if (defined($self->{strBackupHost}) || defined($self->{strDbHost}))
{
- &log(TRACE, "connecting to backup ssh host " . $self->{strBackupHost});
+ my $strOptionSSH = "Compression=no";
- # !!! This could be improved by redirecting stderr to a file to get a better error message
- $self->{oBackupSSH} = Net::OpenSSH->new($self->{strBackupHost}, master_stderr_discard => true, user => $self->{strBackupUser}, master_opts => [-o => "Compression=yes"]);
- $self->{oBackupSSH}->error and confess &log(ERROR, "unable to connect to $self->{strBackupHost}: " . $self->{oBackupSSH}->error);
- }
+ if ($self->{bNoCompression})
+ {
+ $strOptionSSH = "Compression=yes";
+ }
- # Connect SSH object if db host is defined
- if (defined($self->{strDbHost}))
- {
- &log(TRACE, "connecting to database ssh host $self->{strDbHost}");
+ # Connect SSH object if backup host is defined
+ if (defined($self->{strBackupHost}))
+ {
+ &log(TRACE, "connecting to backup ssh host " . $self->{strBackupHost});
- # !!! This could be improved by redirecting stderr to a file to get a better error message
- $self->{oDbSSH} = Net::OpenSSH->new($self->{strDbHost}, master_stderr_discard => true, user => $self->{strDbUser}, master_opts => [-o => "Compression=yes"]);
- $self->{oDbSSH}->error and confess &log(ERROR, "unable to connect to $self->{strDbHost}: " . $self->{oDbSSH}->error);
+ # !!! This could be improved by redirecting stderr to a file to get a better error message
+ $self->{oBackupSSH} = Net::OpenSSH->new($self->{strBackupHost}, master_stderr_discard => true, user => $self->{strBackupUser}, master_opts => [-o => $strOptionSSH]);
+ $self->{oBackupSSH}->error and confess &log(ERROR, "unable to connect to $self->{strBackupHost}: " . $self->{oBackupSSH}->error);
+ }
+
+ # Connect SSH object if db host is defined
+ if (defined($self->{strDbHost}))
+ {
+ &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}, master_stderr_discard => true, user => $self->{strDbUser}, master_opts => [-o => $strOptionSSH]);
+ $self->{oDbSSH}->error and confess &log(ERROR, "unable to connect to $self->{strDbHost}: " . $self->{oDbSSH}->error);
+ }
}
}
[parent: 5c695a6522fd]