From c77fc1fa61582e1983324e7caa5b573fc0eae5e8 Mon Sep 17 00:00:00 2001 From: David Steele Date: Tue, 21 Nov 2017 12:57:00 -0500 Subject: [PATCH] Refactor protocol param generation into a new function. This allows the code to be tested more precisely and doesn't require executing a remote process. --- doc/xml/release.xml | 4 + lib/pgBackRest/Protocol/Helper.pm | 227 +++++++++++------- test/expect/mock-all-002.log | 18 ++ test/expect/mock-archive-002.log | 4 + test/expect/mock-stanza-002.log | 6 + test/lib/pgBackRestTest/Common/DefineTest.pm | 2 +- test/lib/pgBackRestTest/Common/LogTest.pm | 1 + .../Module/Protocol/ProtocolHelperTest.pm | 24 +- 8 files changed, 189 insertions(+), 97 deletions(-) diff --git a/doc/xml/release.xml b/doc/xml/release.xml index c2c19803a..5e52fd9d0 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -63,6 +63,10 @@

Disable gzip filter when --compress-level-network=0. The filter was used with compress level set to 0 which added overhead without any benefit.

+ +

Refactor protocol param generation into a new function. This allows the code to be tested more precisely and doesn't require executing a remote process.

+
+

Add list type for options. The hash type was being used for lists with an additional flag (`value-hash`) to indicate that it was not really a hash.

diff --git a/lib/pgBackRest/Protocol/Helper.pm b/lib/pgBackRest/Protocol/Helper.pm index 07f249348..fff878c85 100644 --- a/lib/pgBackRest/Protocol/Helper.pm +++ b/lib/pgBackRest/Protocol/Helper.pm @@ -139,6 +139,134 @@ sub isDbLocal push @EXPORT, qw(isDbLocal); +#################################################################################################################################### +# Gets the parameters required to setup the protocol +#################################################################################################################################### +sub protocolParam +{ + # Assign function parameters, defaults, and log debug info + my + ( + $strOperation, + $strCommand, + $strRemoteType, + $iRemoteIdx, + $strBackRestBin, + $iProcessIdx, + ) = + logDebugParam + ( + __PACKAGE__ . '::protocolParam', \@_, + {name => 'strCommand'}, + {name => 'strRemoteType'}, + {name => 'iRemoteIdx', default => cfgOptionValid(CFGOPT_HOST_ID) ? cfgOption(CFGOPT_HOST_ID) : 1}, + {name => 'strBackRestBin', optional => true}, + {name => 'iProcessIdx', optional => true}, + ); + + # Return the remote when required + my $iOptionIdCmd = CFGOPT_BACKUP_CMD; + my $iOptionIdConfig = CFGOPT_BACKUP_CONFIG; + my $iOptionIdHost = CFGOPT_BACKUP_HOST; + my $iOptionIdUser = CFGOPT_BACKUP_USER; + my $strOptionDbPath = undef; + my $strOptionDbPort = undef; + my $strOptionDbSocketPath = undef; + my $strOptionSshPort = CFGOPT_BACKUP_SSH_PORT; + + if ($strRemoteType eq CFGOPTVAL_REMOTE_TYPE_DB) + { + $iOptionIdCmd = cfgOptionIdFromIndex(CFGOPT_DB_CMD, $iRemoteIdx); + $iOptionIdConfig = cfgOptionIdFromIndex(CFGOPT_DB_CONFIG, $iRemoteIdx); + $iOptionIdHost = cfgOptionIdFromIndex(CFGOPT_DB_HOST, $iRemoteIdx); + $iOptionIdUser = cfgOptionIdFromIndex(CFGOPT_DB_USER, $iRemoteIdx); + $strOptionSshPort = cfgOptionIdFromIndex(CFGOPT_DB_SSH_PORT, $iRemoteIdx); + } + + # Db path is not valid in all contexts (restore, for instance) + if (cfgOptionValid(cfgOptionIdFromIndex(CFGOPT_DB_PATH, $iRemoteIdx))) + { + $strOptionDbPath = + cfgOptionSource(cfgOptionIdFromIndex(CFGOPT_DB_PATH, $iRemoteIdx)) eq CFGDEF_SOURCE_DEFAULT ? + undef : cfgOption(cfgOptionIdFromIndex(CFGOPT_DB_PATH, $iRemoteIdx)); + } + + # Db port is not valid in all contexts (restore, for instance) + if (cfgOptionValid(cfgOptionIdFromIndex(CFGOPT_DB_PORT, $iRemoteIdx))) + { + $strOptionDbPort = + cfgOptionSource(cfgOptionIdFromIndex(CFGOPT_DB_PORT, $iRemoteIdx)) eq CFGDEF_SOURCE_DEFAULT ? + undef : cfgOption(cfgOptionIdFromIndex(CFGOPT_DB_PORT, $iRemoteIdx)); + } + + # Db socket is not valid in all contexts (restore, for instance) + if (cfgOptionValid(cfgOptionIdFromIndex(CFGOPT_DB_SOCKET_PATH, $iRemoteIdx))) + { + $strOptionDbSocketPath = + cfgOptionSource(cfgOptionIdFromIndex(CFGOPT_DB_SOCKET_PATH, $iRemoteIdx)) eq CFGDEF_SOURCE_DEFAULT ? + undef : cfgOption(cfgOptionIdFromIndex(CFGOPT_DB_SOCKET_PATH, $iRemoteIdx)); + } + + # Build hash to set and override command options + my $rhCommandOption = + { + &CFGOPT_COMMAND => {value => $strCommand}, + &CFGOPT_PROCESS => {value => $iProcessIdx}, + &CFGOPT_CONFIG => + {value => cfgOptionValid($iOptionIdConfig) && cfgOptionSource($iOptionIdConfig) eq CFGDEF_SOURCE_DEFAULT ? + undef : cfgOption($iOptionIdConfig)}, + &CFGOPT_TYPE => {value => $strRemoteType}, + &CFGOPT_LOG_PATH => {}, + &CFGOPT_LOCK_PATH => {}, + + # Don't pass CFGOPT_LOG_LEVEL_STDERR because in the case of the local process calling the remote process the + # option will be set to 'protocol' which is not a valid value from the command line. + &CFGOPT_LOG_LEVEL_STDERR => {}, + + &CFGOPT_DB_PATH => {value => $strOptionDbPath}, + &CFGOPT_DB_PORT => {value => $strOptionDbPort}, + &CFGOPT_DB_SOCKET_PATH => {value => $strOptionDbSocketPath}, + + # Set protocol options explicitly so values are not picked up from remote config files + &CFGOPT_BUFFER_SIZE => {value => cfgOption(CFGOPT_BUFFER_SIZE)}, + &CFGOPT_COMPRESS_LEVEL => {value => cfgOption(CFGOPT_COMPRESS_LEVEL)}, + &CFGOPT_COMPRESS_LEVEL_NETWORK => {value => cfgOption(CFGOPT_COMPRESS_LEVEL_NETWORK)}, + &CFGOPT_PROTOCOL_TIMEOUT => {value => cfgOption(CFGOPT_PROTOCOL_TIMEOUT)} + }; + + # Override some per-db options that shouldn't be passed to the command. ??? This could be done better as a new define + # for these options which would then be implemented in cfgCommandWrite(). + for (my $iOptionIdx = 1; $iOptionIdx <= cfgOptionIndexTotal(CFGOPT_DB_HOST); $iOptionIdx++) + { + if ($iOptionIdx != 1) + { + $rhCommandOption->{cfgOptionIdFromIndex(CFGOPT_DB_CONFIG, $iOptionIdx)} = {}; + $rhCommandOption->{cfgOptionIdFromIndex(CFGOPT_DB_HOST, $iOptionIdx)} = {}; + $rhCommandOption->{cfgOptionIdFromIndex(CFGOPT_DB_PATH, $iOptionIdx)} = {}; + $rhCommandOption->{cfgOptionIdFromIndex(CFGOPT_DB_PORT, $iOptionIdx)} = {}; + $rhCommandOption->{cfgOptionIdFromIndex(CFGOPT_DB_SOCKET_PATH, $iOptionIdx)} = {}; + } + + $rhCommandOption->{cfgOptionIdFromIndex(CFGOPT_DB_CMD, $iOptionIdx)} = {}; + $rhCommandOption->{cfgOptionIdFromIndex(CFGOPT_DB_USER, $iOptionIdx)} = {}; + $rhCommandOption->{cfgOptionIdFromIndex(CFGOPT_DB_SSH_PORT, $iOptionIdx)} = {}; + } + + # Generate the remote command + my $strRemoteCommand = cfgCommandWrite( + CFGCMD_REMOTE, true, defined($strBackRestBin) ? $strBackRestBin : cfgOption($iOptionIdCmd), undef, $rhCommandOption); + + # Return from function and log return values if any + return logDebugReturn + ( + $strOperation, + {name => 'strRemoteHost', value => cfgOption($iOptionIdHost)}, + {name => 'strRemoteHostUser', value => cfgOption($iOptionIdUser)}, + {name => 'strRemoteHostSshPort', value => cfgOption($strOptionSshPort, false)}, + {name => 'strRemoteCommand', value => $strRemoteCommand}, + ); +} + #################################################################################################################################### # protocolGet # @@ -200,106 +328,19 @@ sub protocolGet { logDebugMisc($strOperation, 'create (' . ($bCache ? '' : 'un') . 'cached) remote protocol'); - # Return the remote when required - my $iOptionIdCmd = CFGOPT_BACKUP_CMD; - my $iOptionIdConfig = CFGOPT_BACKUP_CONFIG; - my $iOptionIdHost = CFGOPT_BACKUP_HOST; - my $iOptionIdUser = CFGOPT_BACKUP_USER; - my $strOptionDbPath = undef; - my $strOptionDbPort = undef; - my $strOptionDbSocketPath = undef; - my $strOptionSshPort = CFGOPT_BACKUP_SSH_PORT; - - if ($strRemoteType eq CFGOPTVAL_REMOTE_TYPE_DB) - { - $iOptionIdCmd = cfgOptionIdFromIndex(CFGOPT_DB_CMD, $iRemoteIdx); - $iOptionIdConfig = cfgOptionIdFromIndex(CFGOPT_DB_CONFIG, $iRemoteIdx); - $iOptionIdHost = cfgOptionIdFromIndex(CFGOPT_DB_HOST, $iRemoteIdx); - $iOptionIdUser = cfgOptionIdFromIndex(CFGOPT_DB_USER, $iRemoteIdx); - $strOptionSshPort = cfgOptionIdFromIndex(CFGOPT_DB_SSH_PORT, $iRemoteIdx); - } - - # Db path is not valid in all contexts (restore, for instance) - if (cfgOptionValid(cfgOptionIdFromIndex(CFGOPT_DB_PATH, $iRemoteIdx))) - { - $strOptionDbPath = - cfgOptionSource(cfgOptionIdFromIndex(CFGOPT_DB_PATH, $iRemoteIdx)) eq CFGDEF_SOURCE_DEFAULT ? - undef : cfgOption(cfgOptionIdFromIndex(CFGOPT_DB_PATH, $iRemoteIdx)); - } - - # Db port is not valid in all contexts (restore, for instance) - if (cfgOptionValid(cfgOptionIdFromIndex(CFGOPT_DB_PORT, $iRemoteIdx))) - { - $strOptionDbPort = - cfgOptionSource(cfgOptionIdFromIndex(CFGOPT_DB_PORT, $iRemoteIdx)) eq CFGDEF_SOURCE_DEFAULT ? - undef : cfgOption(cfgOptionIdFromIndex(CFGOPT_DB_PORT, $iRemoteIdx)); - } - - # Db socket is not valid in all contexts (restore, for instance) - if (cfgOptionValid(cfgOptionIdFromIndex(CFGOPT_DB_SOCKET_PATH, $iRemoteIdx))) - { - $strOptionDbSocketPath = - cfgOptionSource(cfgOptionIdFromIndex(CFGOPT_DB_SOCKET_PATH, $iRemoteIdx)) eq CFGDEF_SOURCE_DEFAULT ? - undef : cfgOption(cfgOptionIdFromIndex(CFGOPT_DB_SOCKET_PATH, $iRemoteIdx)); - } - - # Build hash to set and override command options - my $rhCommandOption = - { - &CFGOPT_COMMAND => {value => $strCommand}, - &CFGOPT_PROCESS => {value => $iProcessIdx}, - &CFGOPT_CONFIG => - {value => cfgOptionValid($iOptionIdConfig) && cfgOptionSource($iOptionIdConfig) eq CFGDEF_SOURCE_DEFAULT ? - undef : cfgOption($iOptionIdConfig)}, - &CFGOPT_TYPE => {value => $strRemoteType}, - &CFGOPT_LOG_PATH => {}, - &CFGOPT_LOCK_PATH => {}, - - # Don't pass CFGOPT_LOG_LEVEL_STDERR because in the case of the local process calling the remote process the - # option will be set to 'protocol' which is not a valid value from the command line. - &CFGOPT_LOG_LEVEL_STDERR => {}, - - &CFGOPT_DB_PATH => {value => $strOptionDbPath}, - &CFGOPT_DB_PORT => {value => $strOptionDbPort}, - &CFGOPT_DB_SOCKET_PATH => {value => $strOptionDbSocketPath}, - - # Set protocol options explicitly so values are not picked up from remote config files - &CFGOPT_BUFFER_SIZE => {value => cfgOption(CFGOPT_BUFFER_SIZE)}, - &CFGOPT_COMPRESS_LEVEL => {value => cfgOption(CFGOPT_COMPRESS_LEVEL)}, - &CFGOPT_COMPRESS_LEVEL_NETWORK => {value => cfgOption(CFGOPT_COMPRESS_LEVEL_NETWORK)}, - &CFGOPT_PROTOCOL_TIMEOUT => {value => cfgOption(CFGOPT_PROTOCOL_TIMEOUT)} - }; - - # Override some per-db options that shouldn't be passed to the command. ??? This could be done better as a new define - # for these options which would then be implemented in cfgCommandWrite(). - for (my $iOptionIdx = 1; $iOptionIdx <= cfgOptionIndexTotal(CFGOPT_DB_HOST); $iOptionIdx++) - { - if ($iOptionIdx != 1) - { - $rhCommandOption->{cfgOptionIdFromIndex(CFGOPT_DB_CONFIG, $iOptionIdx)} = {}; - $rhCommandOption->{cfgOptionIdFromIndex(CFGOPT_DB_HOST, $iOptionIdx)} = {}; - $rhCommandOption->{cfgOptionIdFromIndex(CFGOPT_DB_PATH, $iOptionIdx)} = {}; - $rhCommandOption->{cfgOptionIdFromIndex(CFGOPT_DB_PORT, $iOptionIdx)} = {}; - $rhCommandOption->{cfgOptionIdFromIndex(CFGOPT_DB_SOCKET_PATH, $iOptionIdx)} = {}; - } - - $rhCommandOption->{cfgOptionIdFromIndex(CFGOPT_DB_CMD, $iOptionIdx)} = {}; - $rhCommandOption->{cfgOptionIdFromIndex(CFGOPT_DB_USER, $iOptionIdx)} = {}; - $rhCommandOption->{cfgOptionIdFromIndex(CFGOPT_DB_SSH_PORT, $iOptionIdx)} = {}; - } + my ($strRemoteHost, $strRemoteHostUser, $strRemoteHostSshPort, $strRemoteCommand) = protocolParam( + $strCommand, $strRemoteType, $iRemoteIdx, {strBackRestBin => $strBackRestBin, iProcessIdx => $iProcessIdx}); $oProtocol = new pgBackRest::Protocol::Remote::Master ( cfgOption(CFGOPT_CMD_SSH), - cfgCommandWrite( - CFGCMD_REMOTE, true, defined($strBackRestBin) ? $strBackRestBin : cfgOption($iOptionIdCmd), undef, - $rhCommandOption), + $strRemoteCommand, cfgOption(CFGOPT_BUFFER_SIZE), cfgOption(CFGOPT_COMPRESS_LEVEL), cfgOption(CFGOPT_COMPRESS_LEVEL_NETWORK), - cfgOption($iOptionIdHost), - cfgOption($iOptionIdUser), - cfgOption($strOptionSshPort, false), + $strRemoteHost, + $strRemoteHostUser, + $strRemoteHostSshPort, cfgOption(CFGOPT_PROTOCOL_TIMEOUT) ); diff --git a/test/expect/mock-all-002.log b/test/expect/mock-all-002.log index bf3785612..5f0f69182 100644 --- a/test/expect/mock-all-002.log +++ b/test/expect/mock-all-002.log @@ -98,6 +98,8 @@ P00 DEBUG: Db::dbObjectGet(): bMasterOnly = P00 DEBUG: Db->new(): iRemoteIdx = 1 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol +P00 DEBUG: Protocol::Helper::protocolParam(): iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = backup, strRemoteType = db +P00 DEBUG: Protocol::Helper::protocolParam=>: strRemoteCommand = [BACKREST-BIN] --buffer-size=16384 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db1-port=[PORT-1] --db1-socket-path==/test_socket_path --db-timeout=1 --protocol-timeout=2 --repo-path=[TEST_PATH]/backup/repo --repo-type=cifs --stanza=db --type=db remote, strRemoteHost = db-master, strRemoteHostSshPort = [undef], strRemoteHostUser = [USER-1] P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 16384, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 2, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=16384 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db1-port=[PORT-1] --db1-socket-path==/test_socket_path --db-timeout=1 --protocol-timeout=2 --repo-path=[TEST_PATH]/backup/repo --repo-type=cifs --stanza=db --type=db remote, strCommandSSH = /usr/bin/ssh, strHost = db-master, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 16384, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 2, strCommand = /usr/bin/ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no [USER-1]@db-master '[BACKREST-BIN] --buffer-size=16384 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db1-port=[PORT-1] --db1-socket-path==/test_socket_path --db-timeout=1 --protocol-timeout=2 --repo-path=[TEST_PATH]/backup/repo --repo-type=cifs --stanza=db --type=db remote', strId = remote process on 'db-master', strName = remote P00 DEBUG: Db::dbObjectGet=>: iDbMasterIdx = 1, iDbStandbyIdx = [undef], oDbMaster = [object], oDbStandby = [undef] @@ -516,6 +518,8 @@ P00 DEBUG: Db::dbObjectGet(): bMasterOnly = P00 DEBUG: Db->new(): iRemoteIdx = 1 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol +P00 DEBUG: Protocol::Helper::protocolParam(): iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = backup, strRemoteType = db +P00 DEBUG: Protocol::Helper::protocolParam=>: strRemoteCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strRemoteHost = db-master, strRemoteHostSshPort = [undef], strRemoteHostUser = [USER-1] P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no [USER-1]@db-master '[BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote', strId = remote process on 'db-master', strName = remote P00 DEBUG: Db::dbObjectGet=>: iDbMasterIdx = 1, iDbStandbyIdx = [undef], oDbMaster = [object], oDbStandby = [undef] @@ -618,6 +622,8 @@ P00 DEBUG: Db::dbObjectGet(): bMasterOnly = P00 DEBUG: Db->new(): iRemoteIdx = 1 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol +P00 DEBUG: Protocol::Helper::protocolParam(): iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = backup, strRemoteType = db +P00 DEBUG: Protocol::Helper::protocolParam=>: strRemoteCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strRemoteHost = db-master, strRemoteHostSshPort = [undef], strRemoteHostUser = [USER-1] P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no [USER-1]@db-master '[BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote', strId = remote process on 'db-master', strName = remote P00 ERROR: [062]: raised from remote process on 'db-master': stop file exists for all stanzas @@ -695,6 +701,8 @@ P00 DEBUG: Db::dbObjectGet(): bMasterOnly = P00 DEBUG: Db->new(): iRemoteIdx = 1 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol +P00 DEBUG: Protocol::Helper::protocolParam(): iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = backup, strRemoteType = db +P00 DEBUG: Protocol::Helper::protocolParam=>: strRemoteCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strRemoteHost = db-master, strRemoteHostSshPort = [undef], strRemoteHostUser = [USER-1] P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no [USER-1]@db-master '[BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote', strId = remote process on 'db-master', strName = remote P00 ERROR: [062]: raised from remote process on 'db-master': stop file exists for stanza db @@ -794,6 +802,8 @@ P00 DEBUG: Db::dbObjectGet(): bMasterOnly = P00 DEBUG: Db->new(): iRemoteIdx = 1 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol +P00 DEBUG: Protocol::Helper::protocolParam(): iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = backup, strRemoteType = db +P00 DEBUG: Protocol::Helper::protocolParam=>: strRemoteCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strRemoteHost = db-master, strRemoteHostSshPort = [undef], strRemoteHostUser = [USER-1] P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no [USER-1]@db-master '[BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote', strId = remote process on 'db-master', strName = remote P00 DEBUG: Db::dbObjectGet=>: iDbMasterIdx = 1, iDbStandbyIdx = [undef], oDbMaster = [object], oDbStandby = [undef] @@ -923,6 +933,8 @@ P00 DEBUG: Db::dbObjectGet(): bMasterOnly = P00 DEBUG: Db->new(): iRemoteIdx = 1 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol +P00 DEBUG: Protocol::Helper::protocolParam(): iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = backup, strRemoteType = db +P00 DEBUG: Protocol::Helper::protocolParam=>: strRemoteCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strRemoteHost = db-master, strRemoteHostSshPort = [undef], strRemoteHostUser = [USER-1] P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no [USER-1]@db-master '[BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote', strId = remote process on 'db-master', strName = remote P00 DEBUG: Db::dbObjectGet=>: iDbMasterIdx = 1, iDbStandbyIdx = [undef], oDbMaster = [object], oDbStandby = [undef] @@ -1273,6 +1285,8 @@ P00 DEBUG: Common::Lock::lockAcquire=>: bResult = true P00 DEBUG: Storage::Local->pathCreate(): bCreateParent = true, bIgnoreExists = true, strMode = 0770, strPathExp = [TEST_PATH]/db-master/log P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = <1>, strBackRestBin = [undef], strCommand = , strRemoteType = backup P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol +P00 DEBUG: Protocol::Helper::protocolParam(): iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = restore, strRemoteType = backup +P00 DEBUG: Protocol::Helper::protocolParam=>: strRemoteCommand = [BACKREST-BIN] --buffer-size=4194304 --command=restore --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --stanza=db --type=backup remote, strRemoteHost = backup, strRemoteHostSshPort = [undef], strRemoteHostUser = [USER-2] P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=restore --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --stanza=db --type=backup remote, strCommandSSH = /usr/bin/ssh, strHost = backup, strUser = [USER-2] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, strCommand = /usr/bin/ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --buffer-size=4194304 --command=restore --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --stanza=db --type=backup remote', strId = remote process on 'backup', strName = remote P00 DEBUG: Storage::Posix::Driver->new(): bFileSync = , bPathSync = @@ -1675,6 +1689,8 @@ P00 DEBUG: Db::dbObjectGet(): bMasterOnly = P00 DEBUG: Db->new(): iRemoteIdx = 1 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol +P00 DEBUG: Protocol::Helper::protocolParam(): iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = backup, strRemoteType = db +P00 DEBUG: Protocol::Helper::protocolParam=>: strRemoteCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strRemoteHost = db-master, strRemoteHostSshPort = [undef], strRemoteHostUser = [USER-1] P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no [USER-1]@db-master '[BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote', strId = remote process on 'db-master', strName = remote P00 DEBUG: Db::dbObjectGet=>: iDbMasterIdx = 1, iDbStandbyIdx = [undef], oDbMaster = [object], oDbStandby = [undef] @@ -2028,6 +2044,8 @@ P00 DEBUG: Db::dbObjectGet(): bMasterOnly = P00 DEBUG: Db->new(): iRemoteIdx = 1 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = , strRemoteType = db P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol +P00 DEBUG: Protocol::Helper::protocolParam(): iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = backup, strRemoteType = db +P00 DEBUG: Protocol::Helper::protocolParam=>: strRemoteCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strRemoteHost = db-master, strRemoteHostSshPort = [undef], strRemoteHostUser = [USER-1] P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote, strCommandSSH = ssh, strHost = db-master, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no [USER-1]@db-master '[BACKREST-BIN] --buffer-size=4194304 --command=backup --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --stanza=db --type=db remote', strId = remote process on 'db-master', strName = remote P00 DEBUG: Db::dbObjectGet=>: iDbMasterIdx = 1, iDbStandbyIdx = [undef], oDbMaster = [object], oDbStandby = [undef] diff --git a/test/expect/mock-archive-002.log b/test/expect/mock-archive-002.log index 0d46f368b..b92570fab 100644 --- a/test/expect/mock-archive-002.log +++ b/test/expect/mock-archive-002.log @@ -65,6 +65,8 @@ P00 DEBUG: Archive::Push::Push->process(): strWalPathFile = [TEST_PATH]/db- P00 DEBUG: Archive::Push::File::archivePushFile(): bCompress = false, iCompressLevel = 3, strWalFile = 000000010000000100000001, strWalPath = [TEST_PATH]/db-master/db/base/pg_xlog P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = <1>, strBackRestBin = [undef], strCommand = , strRemoteType = backup P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol +P00 DEBUG: Protocol::Helper::protocolParam(): iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = archive-push, strRemoteType = backup +P00 DEBUG: Protocol::Helper::protocolParam=>: strRemoteCommand = [BACKREST-BIN] --buffer-size=4194304 --command=archive-push --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strRemoteHost = backup, strRemoteHostSshPort = [undef], strRemoteHostUser = [USER-1] P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=archive-push --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strCommandSSH = /usr/bin/ssh, strHost = backup, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, strCommand = /usr/bin/ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --buffer-size=4194304 --command=archive-push --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote', strId = remote process on 'backup', strName = remote P00 DEBUG: Protocol::Storage::Remote->new(): oProtocol = [object] @@ -100,6 +102,8 @@ P00 INFO: get WAL segment 000000010000000100000001 P00 DEBUG: Archive::Get::Get->get(): strDestinationFile = [TEST_PATH]/db-master/db/base/pg_xlog/RECOVERYXLOG, strSourceArchive = 000000010000000100000001 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = <1>, strBackRestBin = [undef], strCommand = , strRemoteType = backup P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol +P00 DEBUG: Protocol::Helper::protocolParam(): iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = archive-get, strRemoteType = backup +P00 DEBUG: Protocol::Helper::protocolParam=>: strRemoteCommand = [BACKREST-BIN] --buffer-size=4194304 --command=archive-get --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strRemoteHost = backup, strRemoteHostSshPort = [undef], strRemoteHostUser = [USER-1] P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=archive-get --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strCommandSSH = ssh, strHost = backup, strUser = [USER-1] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --buffer-size=4194304 --command=archive-get --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote', strId = remote process on 'backup', strName = remote P00 DEBUG: Protocol::Storage::Remote->new(): oProtocol = [object] diff --git a/test/expect/mock-stanza-002.log b/test/expect/mock-stanza-002.log index 4f12cf2dc..fd91eae99 100644 --- a/test/expect/mock-stanza-002.log +++ b/test/expect/mock-stanza-002.log @@ -207,6 +207,8 @@ P00 DEBUG: Archive::Push::Push->process(): strWalPathFile = [TEST_PATH]/db- P00 DEBUG: Archive::Push::File::archivePushFile(): bCompress = true, iCompressLevel = 3, strWalFile = 000000010000000100000001, strWalPath = [TEST_PATH]/db-master/db/base/pg_xlog P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = <1>, strBackRestBin = [undef], strCommand = , strRemoteType = backup P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol +P00 DEBUG: Protocol::Helper::protocolParam(): iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = archive-push, strRemoteType = backup +P00 DEBUG: Protocol::Helper::protocolParam=>: strRemoteCommand = [BACKREST-BIN] --buffer-size=4194304 --command=archive-push --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strRemoteHost = backup, strRemoteHostSshPort = [undef], strRemoteHostUser = [USER-2] P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=archive-push --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strCommandSSH = ssh, strHost = backup, strUser = [USER-2] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --buffer-size=4194304 --command=archive-push --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote', strId = remote process on 'backup', strName = remote P00 DEBUG: Protocol::Storage::Remote->new(): oProtocol = [object] @@ -323,6 +325,8 @@ P00 DEBUG: Archive::Push::Push->process(): strWalPathFile = [TEST_PATH]/db- P00 DEBUG: Archive::Push::File::archivePushFile(): bCompress = true, iCompressLevel = 3, strWalFile = 000000010000000100000002, strWalPath = [TEST_PATH]/db-master/db/base/pg_xlog P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = <1>, strBackRestBin = [undef], strCommand = , strRemoteType = backup P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol +P00 DEBUG: Protocol::Helper::protocolParam(): iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = archive-push, strRemoteType = backup +P00 DEBUG: Protocol::Helper::protocolParam=>: strRemoteCommand = [BACKREST-BIN] --buffer-size=4194304 --command=archive-push --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strRemoteHost = backup, strRemoteHostSshPort = [undef], strRemoteHostUser = [USER-2] P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=archive-push --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strCommandSSH = ssh, strHost = backup, strUser = [USER-2] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --buffer-size=4194304 --command=archive-push --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote', strId = remote process on 'backup', strName = remote P00 DEBUG: Protocol::Storage::Remote->new(): oProtocol = [object] @@ -410,6 +414,8 @@ P00 INFO: get WAL segment 000000010000000100000002 P00 DEBUG: Archive::Get::Get->get(): strDestinationFile = [TEST_PATH]/db-master/db/base/pg_xlog/RECOVERYXLOG, strSourceArchive = 000000010000000100000002 P00 DEBUG: Protocol::Helper::protocolGet(): bCache = , iProcessIdx = [undef], iRemoteIdx = <1>, strBackRestBin = [undef], strCommand = , strRemoteType = backup P00 DEBUG: Protocol::Helper::protocolGet: create (cached) remote protocol +P00 DEBUG: Protocol::Helper::protocolParam(): iProcessIdx = [undef], iRemoteIdx = 1, strBackRestBin = [undef], strCommand = archive-get, strRemoteType = backup +P00 DEBUG: Protocol::Helper::protocolParam=>: strRemoteCommand = [BACKREST-BIN] --buffer-size=4194304 --command=archive-get --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strRemoteHost = backup, strRemoteHostSshPort = [undef], strRemoteHostUser = [USER-2] P00 DEBUG: Protocol::Remote::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, iSshPort = [undef], strCommand = [BACKREST-BIN] --buffer-size=4194304 --command=archive-get --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote, strCommandSSH = ssh, strHost = backup, strUser = [USER-2] P00 DEBUG: Protocol::Command::Master->new(): iBufferMax = 4194304, iCompressLevel = 3, iCompressLevelNetwork = 1, iProtocolTimeout = 60, strCommand = ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no backrest@backup '[BACKREST-BIN] --buffer-size=4194304 --command=archive-get --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --db-timeout=45 --protocol-timeout=60 --stanza=db --type=backup remote', strId = remote process on 'backup', strName = remote P00 DEBUG: Protocol::Storage::Remote->new(): oProtocol = [object] diff --git a/test/lib/pgBackRestTest/Common/DefineTest.pm b/test/lib/pgBackRestTest/Common/DefineTest.pm index 4f10aaba7..127b1b4f6 100644 --- a/test/lib/pgBackRestTest/Common/DefineTest.pm +++ b/test/lib/pgBackRestTest/Common/DefineTest.pm @@ -426,7 +426,7 @@ my $oTestDef = }, { &TESTDEF_NAME => 'helper', - &TESTDEF_TOTAL => 1, + &TESTDEF_TOTAL => 2, &TESTDEF_COVERAGE => { diff --git a/test/lib/pgBackRestTest/Common/LogTest.pm b/test/lib/pgBackRestTest/Common/LogTest.pm index e21d63a3c..ad1f5f6ca 100644 --- a/test/lib/pgBackRestTest/Common/LogTest.pm +++ b/test/lib/pgBackRestTest/Common/LogTest.pm @@ -388,6 +388,7 @@ sub regExpReplaceAll $strLine = $self->regExpReplace($strLine, 'GROUP', 'set ownership [^\:]+:[^ ]+', '[^\:]+$'); $strLine = $self->regExpReplace($strLine, 'GROUP', TEST_USER . '\, ' . TEST_GROUP, '[^ ]+$'); + $strLine = $self->regExpReplace($strLine, 'USER', 'strRemoteHostUser = [^ \n,\[\]]+', '[^ \n,\[\]]+$'); $strLine = $self->regExpReplace($strLine, 'USER', 'strUser = [^ \n,\[\]]+', '[^ \n,\[\]]+$'); $strLine = $self->regExpReplace($strLine, 'USER', 'user"[ ]{0,1}:[ ]{0,1}"[^"]+', '[^"]+$'); $strLine = $self->regExpReplace($strLine, 'USER', 'user=\"[^"]+', '[^"]+$'); diff --git a/test/lib/pgBackRestTest/Module/Protocol/ProtocolHelperTest.pm b/test/lib/pgBackRestTest/Module/Protocol/ProtocolHelperTest.pm index 49d35d79e..3a85b4d55 100644 --- a/test/lib/pgBackRestTest/Module/Protocol/ProtocolHelperTest.pm +++ b/test/lib/pgBackRestTest/Module/Protocol/ProtocolHelperTest.pm @@ -23,6 +23,7 @@ use pgBackRest::Config::Config; use pgBackRest::Protocol::Helper; use pgBackRest::Protocol::Storage::Helper; use pgBackRest::Storage::Helper; +use pgBackRest::Version; use pgBackRestTest::Env::HostEnvTest; use pgBackRestTest::Common::ExecuteTest; @@ -50,8 +51,6 @@ sub initTest # Create archive info storageTest()->pathCreate($self->{strArchivePath}, {bIgnoreExists => true, bCreateParent => true}); - - $self->initOption(); } #################################################################################################################################### @@ -61,6 +60,8 @@ sub initOption { my $self = shift; + $self->configTestClear(); + $self->optionTestSet(CFGOPT_STANZA, $self->stanza()); $self->optionTestSet(CFGOPT_DB_PATH, $self->{strDbPath}); $self->optionTestSet(CFGOPT_REPO_PATH, $self->{strRepoPath}); @@ -79,11 +80,28 @@ sub run { my $self = shift; - my $oOption = $self->initOption(); + ################################################################################################################################ + if ($self->begin('protocolParam()')) + { + $self->optionTestSet(CFGOPT_STANZA, $self->stanza()); + $self->optionTestSet(cfgOptionIdFromIndex(CFGOPT_DB_HOST, 1), 'db-host-1'); + $self->optionTestSet(cfgOptionIdFromIndex(CFGOPT_DB_PATH, 1), '/db1'); + $self->optionTestSet(cfgOptionIdFromIndex(CFGOPT_DB_PORT, 1), '1111'); + $self->optionTestSet(cfgOptionIdFromIndex(CFGOPT_DB_CMD, 1), 'pgbackrest1'); + $self->configTestLoad(CFGCMD_BACKUP); + + $self->testResult( + sub {pgBackRest::Protocol::Helper::protocolParam( + cfgCommandName(CFGCMD_BACKUP), CFGOPTVAL_REMOTE_TYPE_DB, 1)}, + '(db-host-1, postgres, [undef], pgbackrest1 --buffer-size=4194304 --command=backup --compress-level=6' . + ' --compress-level-network=3 --db1-path=/db1 --db1-port=1111 --protocol-timeout=1830 --stanza=db --type=db remote)', + 'more than one backup db host'); + } ################################################################################################################################ if ($self->begin("Protocol::Helper")) { + $self->initOption(); $self->optionTestSet(CFGOPT_BACKUP_HOST, 'localhost'); $self->optionTestSet(CFGOPT_BACKUP_USER, $self->pgUser()); $self->configTestLoad(CFGCMD_ARCHIVE_PUSH);