1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-03-03 14:52:21 +02:00

Added TTY code.

This commit is contained in:
David Steele 2014-04-01 08:59:09 -04:00
parent 2b8972936f
commit 7624d65edf
5 changed files with 24 additions and 5 deletions

View File

@ -8,8 +8,16 @@ Simple Postgres Backup and Restore
* Able to set timeout on ssh connection in config file.
* Fix bug where .backup files written into old directories can cause the archive process to error.
* Add configurable sleep to archiver process to reduce ssh connections.
## release notes
### v0.16: RequestTTY=yes for SSH sessions
* Added RequestTTY=yes to ssh sesssions. Hoping this will prevent random lockups.
### v0.15: Added archive-get
* Added archive-get functionality to aid in restores.

View File

@ -401,6 +401,7 @@ if ($strOperation eq OP_ARCHIVE_PUSH || $strOperation eq OP_ARCHIVE_PULL)
# Call the archive_pull function Continue to loop as long as there are files to process.
while (archive_pull($strArchivePath . "/archive/${strStanza}", $strStopFile, $strCommand, $iArchiveMaxMB))
{
&log(DEBUG, "archive logs were transferred, calling archive_pull() again")
}
};

View File

@ -362,6 +362,10 @@ sub archive_pull
&log(DEBUG, "removing local archive path ${strPath}");
rmdir($strArchivePath . "/" . $strPath) or confess &log(ERROR, "unable to remove archive path ${strPath}, is it empty?");
}
# If the dir is not empty check if the files are in the manifest
# If they are error - there has been some issue
# If not, they are new - continue processing without error - they'll be picked up on the next run
}
# Return number of files indicating that processing should continue

View File

@ -35,10 +35,13 @@ sub BUILD
# Connect SSH object if db host is defined
if (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});
$self->{oDbSSH} = Net::OpenSSH->new($self->{strDbHost}, user => $self->{strDbUser},
master_opts => [-o => $strOptionSSHRequestTTY]);
$self->{oDbSSH}->error and confess &log(ERROR, "unable to connect to $self->{strDbHost}: " . $self->{oDbSSH}->error);
}
}

View File

@ -67,11 +67,12 @@ sub BUILD
# Create the ssh options string
if (defined($self->{strBackupHost}) || defined($self->{strDbHost}))
{
my $strOptionSSH = "Compression=no";
my $strOptionSSHRequestTTY = "RequestTTY=yes";
my $strOptionSSHCompression = "Compression=no";
if ($self->{bNoCompression})
{
$strOptionSSH = "Compression=yes";
$strOptionSSHCompression = "Compression=yes";
}
# Connect SSH object if backup host is defined
@ -80,7 +81,8 @@ sub BUILD
&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->{oBackupSSH} = Net::OpenSSH->new($self->{strBackupHost}, timeout => 300, user => $self->{strBackupUser}, master_opts => [-o => $strOptionSSH]);
$self->{oBackupSSH} = Net::OpenSSH->new($self->{strBackupHost}, timeout => 300, user => $self->{strBackupUser},
master_opts => [-o => $strOptionSSHCompression, -o => $strOptionSSHRequestTTY]);
$self->{oBackupSSH}->error and confess &log(ERROR, "unable to connect to $self->{strBackupHost}: " . $self->{oBackupSSH}->error);
}
@ -90,7 +92,8 @@ sub BUILD
&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}, timeout => 300, user => $self->{strDbUser}, master_opts => [-o => $strOptionSSH]);
$self->{oDbSSH} = Net::OpenSSH->new($self->{strDbHost}, timeout => 300, user => $self->{strDbUser},
master_opts => [-o => $strOptionSSHCompression, -o => $strOptionSSHRequestTTY]);
$self->{oDbSSH}->error and confess &log(ERROR, "unable to connect to $self->{strDbHost}: " . $self->{oDbSSH}->error);
}
}