1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00

Fixed timeout issue.

The protocol-timeout option was not automatically increased when the db-timeout option was increased.

Reported by Todd Vernick.
This commit is contained in:
David Steele 2016-08-25 11:27:00 -04:00
parent 5ada189a92
commit c9bdf6a9ae
3 changed files with 35 additions and 4 deletions

View File

@ -92,6 +92,11 @@
<contributor-id type="github">gregscds</contributor-id>
</contributor>
<contributor id="vernick.todd">
<contributor-name-display>Todd Vernick</contributor-name-display>
<contributor-id type="github">gintoddic</contributor-id>
</contributor>
<contributor id="vitale.michael">
<contributor-name-display>Michael Vitale</contributor-name-display>
<contributor-id type="github">MichaelDBA</contributor-id>
@ -127,6 +132,14 @@
<p>Fixed an issue where options that should not allow multiple values could be specified multiple times in <file>pgbackrest.conf</file> without an error being raised.</p>
</release-item>
<release-item>
<release-item-contributor-list>
<release-item-ideator id="vernick.todd"/>
</release-item-contributor-list>
<p>Fixed an issue where the <br-option>protocol-timeout</br-option> option was not automatically increased when the <br-option>db-timeout</br-option> option was increased.</p>
</release-item>
</release-bug-list>
<release-feature-list>

View File

@ -1832,10 +1832,18 @@ sub configLoad
if (optionTest(OPTION_DB_TIMEOUT) && optionTest(OPTION_PROTOCOL_TIMEOUT) &&
optionGet(OPTION_PROTOCOL_TIMEOUT) <= optionGet(OPTION_DB_TIMEOUT))
{
confess &log(ERROR,
"'" . optionGet(OPTION_PROTOCOL_TIMEOUT) . "' is not valid for '" . OPTION_PROTOCOL_TIMEOUT . "' option\n" .
"HINT: 'protocol-timeout' option should be greater than 'db-timeout' option.",
ERROR_OPTION_INVALID_VALUE);
# If protocol-timeout is default then increase it to be greater than db-timeout
if (optionSource(OPTION_PROTOCOL_TIMEOUT) eq SOURCE_DEFAULT)
{
optionSet(OPTION_PROTOCOL_TIMEOUT, optionGet(OPTION_DB_TIMEOUT) + 30);
}
else
{
confess &log(ERROR,
"'" . optionGet(OPTION_PROTOCOL_TIMEOUT) . "' is not valid for '" . OPTION_PROTOCOL_TIMEOUT . "' option\n" .
"HINT: 'protocol-timeout' option should be greater than 'db-timeout' option.",
ERROR_OPTION_INVALID_VALUE);
}
}
# Make sure that backup and db are not both remote

View File

@ -569,6 +569,16 @@ sub configTestRun
configLoadExpect($oOption, CMD_BACKUP, ERROR_OPTION_REQUIRED, OPTION_DB_PATH, 'does this stanza exist?');
}
if (testRun(++$iRun, CMD_BACKUP . ' automatically increase ' . OPTION_PROTOCOL_TIMEOUT))
{
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_DB_PATH, '/db');
optionSetTest($oOption, OPTION_DB_TIMEOUT, OPTION_DEFAULT_PROTOCOL_TIMEOUT + 30);
configLoadExpect($oOption, CMD_BACKUP);
optionTestExpect(OPTION_PROTOCOL_TIMEOUT, OPTION_DEFAULT_PROTOCOL_TIMEOUT + 60);
}
}
#-------------------------------------------------------------------------------------------------------------------------------